70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using BrewMonster.Network;
|
|
using BrewMonster.Scripts;
|
|
using BrewMonster.Scripts.Skills;
|
|
using CSNetwork.GPDataType;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
/// <summary>
|
|
/// Shortcut representing a combo skill group.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class CECSCSkillGrp : CECShortcut
|
|
{
|
|
private int m_iGroupIdx;
|
|
private string m_strDesc;
|
|
|
|
public CECSCSkillGrp()
|
|
{
|
|
m_iSCType = (int)ShortcutType.SCT_SKILLGRP;
|
|
m_iGroupIdx = -1;
|
|
m_strDesc = string.Empty;
|
|
}
|
|
|
|
private CECSCSkillGrp(CECSCSkillGrp src)
|
|
{
|
|
m_iSCType = src.m_iSCType;
|
|
m_iGroupIdx = src.m_iGroupIdx;
|
|
m_strDesc = src.m_strDesc;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize the shortcut and build its description from the string tables.
|
|
/// </summary>
|
|
public bool Init(int iGroupIdx)
|
|
{
|
|
m_iGroupIdx = iGroupIdx;
|
|
var strTab = EC_Game.GetItemDesc();
|
|
string format = strTab?.GetWideString((int)DescriptipionMsg.CMDDESC_SKILLGROUP);
|
|
|
|
if (string.IsNullOrEmpty(format))
|
|
m_strDesc = $"Skill Group {m_iGroupIdx}";
|
|
else
|
|
m_strDesc = GPDataTypeHelper.ReplacePercentD(format, m_iGroupIdx);
|
|
|
|
return true;
|
|
}
|
|
|
|
public int GetGroupIndex() => m_iGroupIdx;
|
|
|
|
public string GetDesc() => m_strDesc;
|
|
|
|
public override CECShortcut Clone() => new CECSCSkillGrp(this);
|
|
|
|
public override bool Execute()
|
|
{
|
|
CECHostPlayer host = EC_Game.GetGameRun().GetHostPlayer();
|
|
if (host == null) {
|
|
BMLogger.LogError("HostPlayer = null in CECSCSkillGrp::Execute");
|
|
return false;
|
|
}
|
|
|
|
host.ApplyComboSkill(m_iGroupIdx, false, -1);
|
|
return true;
|
|
}
|
|
}
|
|
}
|