713 lines
26 KiB
C#
713 lines
26 KiB
C#
using System.Collections.Generic;
|
||
using GCGame.Table;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class AttrInfo
|
||
{
|
||
public int m_attrType; //该属性的类型
|
||
public float m_attrValue; //该属性的值
|
||
public bool m_isChange; //该属性值是否有修改
|
||
public string m_name; //属性名字
|
||
public string m_sendKeyStr; //发送给服务器的格式化字符串
|
||
public int m_Type; // 属性属于哪一类型 0一级属性 1基础属性 2特殊属性 3效果属性 4元素属性 5资源属性 6技能等级属性
|
||
|
||
public AttrInfo(int type, string name, bool isChange, int attrType, float attrValue, string sendKey)
|
||
{
|
||
m_Type = type;
|
||
m_attrType = attrType;
|
||
m_name = name;
|
||
m_isChange = isChange;
|
||
m_attrValue = attrValue;
|
||
m_sendKeyStr = sendKey;
|
||
}
|
||
|
||
public void SendGmInfo()
|
||
{
|
||
// if (m_name == "灵玉" && PlatformHelper.UseSdk())
|
||
// {
|
||
// PlatformHelper.Pay(m_attrValue, "测试");
|
||
// }
|
||
// else
|
||
// {
|
||
var packet = (CG_GMCOMMAND) PacketDistributed.CreatePacket(MessageID.PACKET_CG_GMCOMMAND);
|
||
m_sendKeyStr = m_sendKeyStr.Replace(' ', ',');
|
||
packet.Cmd = string.Format(m_sendKeyStr, m_attrValue);
|
||
packet.SendPacket();
|
||
// }
|
||
}
|
||
}
|
||
|
||
public class GMPanel : MonoBehaviour
|
||
{
|
||
private readonly Dictionary<int, UIContainerBase> AttrParentObjs = new Dictionary<int, UIContainerBase>();
|
||
private readonly List<GameObject> m_clones = new List<GameObject>();
|
||
private readonly Dictionary<string, GameObject> m_Clones = new Dictionary<string, GameObject>();
|
||
|
||
//此处可以使用表格代替,看有没有必要使用表格
|
||
//所有面板上需要展示的信息
|
||
private readonly Dictionary<int, AttrInfo> m_info = new Dictionary<int, AttrInfo>
|
||
{
|
||
//一级属性
|
||
{
|
||
0,
|
||
new AttrInfo(0, "体质", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.CONSTITU) + "{0}")
|
||
},
|
||
{1, new AttrInfo(0, "精力", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MORFIB) + "{0}")},
|
||
{
|
||
2,
|
||
new AttrInfo(0, "力量", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.STRENGTH) + "{0}")
|
||
},
|
||
{
|
||
3,
|
||
new AttrInfo(0, "智力", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.INTELLENG) + "{0}")
|
||
},
|
||
{4, new AttrInfo(0, "敏捷", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.AGILE) + "{0}")},
|
||
{
|
||
5,
|
||
new AttrInfo(0, "法术防御", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MAGDEF) + "{0}")
|
||
},
|
||
|
||
//基础属性
|
||
{6, new AttrInfo(1, "等级", false, 0, 0, "inclevel,{0}")},
|
||
{7, new AttrInfo(1, "副本", false, 0, 0, "createfb {0} 1")},
|
||
{8, new AttrInfo(1, "最大生命", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MAXHP) + "{0}")},
|
||
{9, new AttrInfo(1, "最大法力", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MAXMP) + "{0}")},
|
||
{
|
||
10,
|
||
new AttrInfo(1, "法术攻击", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.MAGATTACK) + "{0}")
|
||
},
|
||
{
|
||
90,
|
||
new AttrInfo(1, "物理攻击", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.PYSATTACK) + "{0}")
|
||
},
|
||
{
|
||
11,
|
||
new AttrInfo(1, "治疗量", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.CUREAMOUNT) + "{0}")
|
||
},
|
||
{
|
||
12,
|
||
new AttrInfo(1, "物理防御", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.PYSDEF) + "{0}")
|
||
},
|
||
{
|
||
13,
|
||
new AttrInfo(1, "法术防御", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MAGDEF) + "{0}")
|
||
},
|
||
{
|
||
14,
|
||
new AttrInfo(1, "晕命中", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.MAGDEF) + "{0}")
|
||
},
|
||
{15, new AttrInfo(1, "闪避", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.DODGE) + "{0}")},
|
||
{
|
||
16,
|
||
new AttrInfo(1, "暴击", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.CRITICAL) + "{0}")
|
||
},
|
||
{
|
||
17,
|
||
new AttrInfo(1, "暴抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DECRITICAL) + "{0}")
|
||
},
|
||
{
|
||
18,
|
||
new AttrInfo(1, "修为", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.ABILITYLEVEL) + "{0}")
|
||
},
|
||
|
||
//特殊属性
|
||
{19, new AttrInfo(2, "穿透", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.STRIKE) + "{0}")},
|
||
{
|
||
20,
|
||
new AttrInfo(2, "坚韧", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.DUCTICAL) + "{0}")
|
||
},
|
||
{
|
||
21,
|
||
new AttrInfo(2, "暴击伤害减免", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.CRITIMIS) + "{0}")
|
||
},
|
||
{
|
||
22,
|
||
new AttrInfo(2, "无视防御伤害", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.INGDEF) + "{0}")
|
||
},
|
||
{
|
||
23,
|
||
new AttrInfo(2, "固定伤害减免", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.REDUCEDAM) + "{0}")
|
||
},
|
||
{24, new AttrInfo(2, "对天玑伤害加成", false, 0, 0, "1")},
|
||
{25, new AttrInfo(2, "对六扇伤害加成", false, 0, 0, "1")},
|
||
{26, new AttrInfo(2, "对玄女伤害加成", false, 0, 0, "1")},
|
||
{27, new AttrInfo(2, "对蜀山伤害加成", false, 0, 0, "1")},
|
||
{
|
||
28,
|
||
new AttrInfo(2, "对宠物加成", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DAMGRATEADDPET) + "{0}")
|
||
},
|
||
{
|
||
29,
|
||
new AttrInfo(2, "对BOSS加成", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DAMGRATEADDBOSS) + "{0}")
|
||
},
|
||
{
|
||
30,
|
||
new AttrInfo(2, "对小怪加成", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DAMGRATEADDMONSTER) + "{0}")
|
||
},
|
||
|
||
//效果属性
|
||
{
|
||
31,
|
||
new AttrInfo(3, "眩晕增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DIZZYENHANCE) + "{0}")
|
||
},
|
||
{
|
||
32,
|
||
new AttrInfo(3, "眩晕抗性", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DIZZYEDEF) + "{0}")
|
||
},
|
||
{
|
||
33,
|
||
new AttrInfo(3, "沉默增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SILENTENHANCE) + "{0}")
|
||
},
|
||
{
|
||
34,
|
||
new AttrInfo(3, "沉默抗性", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SILENTDEF) + "{0}")
|
||
},
|
||
{
|
||
35,
|
||
new AttrInfo(3, "定身增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.IMMOBENHANCE) + "{0}")
|
||
},
|
||
{
|
||
36,
|
||
new AttrInfo(3, "定身抗性", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.IMMOBDEF) + "{0}")
|
||
},
|
||
{
|
||
37,
|
||
new AttrInfo(3, "击退增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.REPELENHANCE) + "{0}")
|
||
},
|
||
{
|
||
38,
|
||
new AttrInfo(3, "击退抗性", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.REPELDEF) + "{0}")
|
||
},
|
||
{
|
||
39,
|
||
new AttrInfo(3, "变羊增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.POLYMORPHENHANCE) + "{0}")
|
||
},
|
||
{
|
||
40,
|
||
new AttrInfo(3, "变羊抗性", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.POLYMORPHDEF) + "{0}")
|
||
},
|
||
{
|
||
41,
|
||
new AttrInfo(3, "昏迷增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.HMENHANCE) + "{0}")
|
||
},
|
||
{
|
||
42,
|
||
new AttrInfo(3, "昏迷抗性", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.HMDEF) + "{0}")
|
||
},
|
||
{
|
||
43,
|
||
new AttrInfo(3, "失明增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SMENHANCE) + "{0}")
|
||
},
|
||
{
|
||
44,
|
||
new AttrInfo(3, "失明抗性", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.SMDEF) + "{0}")
|
||
},
|
||
{
|
||
45,
|
||
new AttrInfo(3, "石化增强", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SHENHANCE) + "{0}")
|
||
},
|
||
{
|
||
46,
|
||
new AttrInfo(3, "石化抗性", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.SHDEF) + "{0}")
|
||
},
|
||
|
||
//元素属性
|
||
{
|
||
47,
|
||
new AttrInfo(4, "火抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.HUOGDEF) + "{0}")
|
||
},
|
||
{
|
||
48,
|
||
new AttrInfo(4, "忽视火抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.HUOGIGNDEF) + "{0}")
|
||
},
|
||
{49, new AttrInfo(4, "风抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.FGDEF) + "{0}")},
|
||
{
|
||
50,
|
||
new AttrInfo(4, "忽视风抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.FGIGNDEF) + "{0}")
|
||
},
|
||
{51, new AttrInfo(4, "毒抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.DUGDEF) + "{0}")},
|
||
{
|
||
52,
|
||
new AttrInfo(4, "忽视毒抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DUGIGNDEF) + "{0}")
|
||
},
|
||
{
|
||
53,
|
||
new AttrInfo(4, "幻抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.HUANGDEF) + "{0}")
|
||
},
|
||
{
|
||
54,
|
||
new AttrInfo(4, "忽视幻抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.HUANGIFNDEF) + "{0}")
|
||
},
|
||
{55, new AttrInfo(4, "光抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.GGDEF) + "{0}")},
|
||
{
|
||
56,
|
||
new AttrInfo(4, "忽视光抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.GGIGNDEF) + "{0}")
|
||
},
|
||
{57, new AttrInfo(4, "冰抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.DGDEF) + "{0}")},
|
||
{
|
||
58,
|
||
new AttrInfo(4, "忽视冰抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.BGIGNDEF) + "{0}")
|
||
},
|
||
{59, new AttrInfo(4, "电抗", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.DGDEF) + "{0}")},
|
||
{
|
||
60,
|
||
new AttrInfo(4, "忽视电抗", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.DGIGNDEF) + "{0}")
|
||
},
|
||
|
||
//资源属性
|
||
{
|
||
61,
|
||
new AttrInfo(5, "元宝", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.BIND_YUANBAO) + "{0}")
|
||
},
|
||
{
|
||
62,
|
||
new AttrInfo(5, "灵玉", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.YUANBAO) + "{0}")
|
||
},
|
||
{
|
||
63,
|
||
new AttrInfo(5, "银两", false, 0, 0, string.Format("setprop {0} ", (int) PropID.PropertyID.YINLIANG) + "{0}")
|
||
},
|
||
{
|
||
64,
|
||
new AttrInfo(5, "银票", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.BIND_YINLIANG) + "{0}")
|
||
},
|
||
//{65,new AttrInfo(5,"经验",false,0,0,"incexp,{0}")},
|
||
//{66,new AttrInfo(5,"专属经验",false,0,0,"incrprivateexp {0}")},
|
||
{
|
||
65,
|
||
new AttrInfo(5, "经验", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.PROPUSER_EXP) + "{0}")
|
||
},
|
||
{
|
||
66,
|
||
new AttrInfo(5, "专属经验", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.PRIVATEEXP) + "{0}")
|
||
},
|
||
{67, new AttrInfo(5, "帮贡", false, 0, 0, "inccontribute")},
|
||
{
|
||
68,
|
||
new AttrInfo(5, "关宁积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.GUANNING) + "{0}")
|
||
},
|
||
{
|
||
69,
|
||
new AttrInfo(5, "情谊积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.QINGYIZHI) + "{0}")
|
||
},
|
||
{
|
||
100,
|
||
new AttrInfo(5, "比武积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.FIGHTSCORE) + "{0}")
|
||
},
|
||
{
|
||
101,
|
||
new AttrInfo(5, "门派积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.CHAELLENGESCORE) + "{0}")
|
||
},
|
||
{
|
||
102,
|
||
new AttrInfo(5, "夺宝积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SNATCHSCORE) + "{0}")
|
||
},
|
||
{
|
||
103,
|
||
new AttrInfo(5, "受赠积分", false, 0, 0,
|
||
string.Format("setprop {0} ", (int) PropID.PropertyID.SHOUZENG) + "{0}")
|
||
},
|
||
|
||
//技能等级
|
||
{71, new AttrInfo(6, "技能1等级", false, 0, 0, "1")},
|
||
{72, new AttrInfo(6, "技能2等级", false, 0, 0, "1")},
|
||
{73, new AttrInfo(6, "技能3等级", false, 0, 0, "1")},
|
||
{74, new AttrInfo(6, "技能4等级", false, 0, 0, "1")},
|
||
{75, new AttrInfo(6, "技能5等级", false, 0, 0, "1")},
|
||
{76, new AttrInfo(6, "技能6等级", false, 0, 0, "1")},
|
||
{77, new AttrInfo(6, "技能7等级", false, 0, 0, "1")},
|
||
{78, new AttrInfo(6, "技能8等级", false, 0, 0, "1")},
|
||
{79, new AttrInfo(6, "技能9等级", false, 0, 0, "1")},
|
||
{80, new AttrInfo(6, "技能10等级", false, 0, 0, "1")},
|
||
|
||
//功能玩法
|
||
{81, new AttrInfo(7, "吉星高照", false, 0, 0, "1")},
|
||
{82, new AttrInfo(7, "守财奴", false, 0, 0, "1")},
|
||
{83, new AttrInfo(7, "采薇", false, 0, 0, "1")},
|
||
{84, new AttrInfo(7, "帮会大贼", false, 0, 0, "1")},
|
||
{85, new AttrInfo(7, "科举答题", false, 0, 0, "1")},
|
||
{86, new AttrInfo(7, "帮会跑商", false, 0, 0, "1")},
|
||
{87, new AttrInfo(7, "货运任务", false, 0, 0, "1")},
|
||
{88, new AttrInfo(7, "关宁战场", false, 0, 0, "1")},
|
||
{89, new AttrInfo(7, "帮派战场", false, 0, 0, "1")}
|
||
};
|
||
|
||
public UIContainerBase _BaseItemsContainer; //基础属性框
|
||
public UIContainerBase _DataItemsContainer; //元素属性框
|
||
public UIContainerBase _EffectItemsContainer; //效果属性框
|
||
|
||
public UIContainerBase _FirstItemsContainer; //一级属性框
|
||
public UIContainerBase _FunItemsContainer; //功能玩法属性框
|
||
public UIContainerBase _ResourceItemsContainer; //资源属性框
|
||
public UIContainerBase _SkillItemsContainer; //技能属性框
|
||
public UIContainerBase _SpecialItemsContainer; //特殊属性框
|
||
public GameObject AddItemWnd; //添加物品
|
||
public GameObject AttrInfoWnd; //属性面板
|
||
public GameObject FunInfoWnd; //功能面板
|
||
public InputField m_ClassID;
|
||
|
||
public InputField m_inputNum;
|
||
public InputField m_SearchName;
|
||
public InputField m_SubClassID;
|
||
|
||
|
||
//宠物
|
||
public GameObject PetItemObj;
|
||
|
||
private void Start()
|
||
{
|
||
AttrParentObjs.Add(0, _FirstItemsContainer);
|
||
AttrParentObjs.Add(1, _BaseItemsContainer);
|
||
AttrParentObjs.Add(2, _SpecialItemsContainer);
|
||
AttrParentObjs.Add(3, _EffectItemsContainer);
|
||
AttrParentObjs.Add(4, _DataItemsContainer);
|
||
AttrParentObjs.Add(5, _ResourceItemsContainer);
|
||
AttrParentObjs.Add(6, _SkillItemsContainer);
|
||
AttrParentObjs.Add(7, _FunItemsContainer);
|
||
|
||
ShowAttrWnd();
|
||
|
||
//开启UI时,激活聊天框GM按钮
|
||
FunctionButtonLogic.Instance()._BtnGM.SetActive(true);
|
||
}
|
||
|
||
public void ShowItemsWnd()
|
||
{
|
||
if (AttrInfoWnd != null)
|
||
AttrInfoWnd.SetActive(false);
|
||
if (FunInfoWnd != null)
|
||
FunInfoWnd.SetActive(false);
|
||
if (AddItemWnd != null)
|
||
AddItemWnd.SetActive(true);
|
||
ShowItems();
|
||
}
|
||
|
||
public void ShowAttrWnd()
|
||
{
|
||
if (AttrInfoWnd != null)
|
||
AttrInfoWnd.SetActive(true);
|
||
if (FunInfoWnd != null)
|
||
FunInfoWnd.SetActive(false);
|
||
if (AddItemWnd != null)
|
||
AddItemWnd.SetActive(false);
|
||
InitAttarContent(0);
|
||
InitAttarContent(1);
|
||
InitAttarContent(2);
|
||
InitAttarContent(3);
|
||
InitAttarContent(4);
|
||
}
|
||
|
||
public void ShowFunWnd()
|
||
{
|
||
if (AttrInfoWnd != null)
|
||
AttrInfoWnd.SetActive(false);
|
||
if (FunInfoWnd != null)
|
||
FunInfoWnd.SetActive(true);
|
||
if (AddItemWnd != null)
|
||
AddItemWnd.SetActive(false);
|
||
InitAttarContent(5);
|
||
InitAttarContent(6);
|
||
InitAttarContent(7);
|
||
}
|
||
|
||
public void InitAttarContent(int type)
|
||
{
|
||
var Valus = new List<AttrInfo>(m_info.Values);
|
||
var showItems = new List<AttrInfo>();
|
||
for (var i = 0; i < Valus.Count; i++)
|
||
{
|
||
var info = Valus[i];
|
||
if (info.m_Type == type) showItems.Add(info);
|
||
}
|
||
|
||
AttrParentObjs[type].InitContentItem(showItems);
|
||
}
|
||
|
||
public void OnAttrInputChange(int index, InputField input)
|
||
{
|
||
if (input == null)
|
||
return;
|
||
if (m_info.ContainsKey(index) == false)
|
||
return;
|
||
float value = 0;
|
||
float.TryParse(input.text, out value);
|
||
m_info[index].m_attrValue = value;
|
||
}
|
||
|
||
public void OnCloseClick()
|
||
{
|
||
UIManager.CloseUI(UIInfo.GMWnd);
|
||
}
|
||
|
||
public void OnOkBtnClick()
|
||
{
|
||
var valus = new List<AttrInfo>(m_info.Values);
|
||
for (var i = 0; i < valus.Count; i++)
|
||
{
|
||
var info = valus[i];
|
||
if (info.m_isChange)
|
||
{
|
||
info.m_isChange = false;
|
||
info.SendGmInfo();
|
||
}
|
||
}
|
||
|
||
UIManager.CloseUI(UIInfo.GMWnd);
|
||
}
|
||
|
||
public void SearchItem()
|
||
{
|
||
if (m_SearchName == null)
|
||
return;
|
||
if (m_Clones == null)
|
||
return;
|
||
if (m_Clones.ContainsKey(m_SearchName.text))
|
||
m_Clones[m_SearchName.text].transform.SetAsFirstSibling();
|
||
else
|
||
ShowSearchItems();
|
||
}
|
||
|
||
public void ShowSearchItems()
|
||
{
|
||
var items = TableManager.GetCommonItem().Values;
|
||
for (var i = 0; i < m_clones.Count; i++)
|
||
{
|
||
m_clones[i].transform.SetParent(null);
|
||
m_clones[i].SetActive(false);
|
||
Destroy(m_clones[i]);
|
||
}
|
||
|
||
m_clones.Clear();
|
||
m_Clones.Clear();
|
||
foreach (var item in items)
|
||
if (item.Id.ToString() == m_SearchName.text || item.Name.Contains(m_SearchName.text))
|
||
{
|
||
var newObj = Instantiate(PetItemObj);
|
||
if (newObj == null)
|
||
continue;
|
||
newObj.SetActive(true);
|
||
newObj.transform.SetParent(PetItemObj.transform.parent);
|
||
newObj.transform.localPosition = Vector3.zero;
|
||
newObj.transform.localScale = PetItemObj.transform.localScale;
|
||
m_Clones[item.Name] = newObj;
|
||
m_clones.Add(newObj);
|
||
var image = newObj.GetComponentInChildren<Image>();
|
||
if (image != null)
|
||
{
|
||
LoadAssetBundle.Instance.SetImageSprite(image, item.Icon);
|
||
if (item.QualityEffect > 0)
|
||
CommonItemContainerItem.ShowQualityEffect(true, item.QualityEffect, image.transform);
|
||
else
|
||
CommonItemContainerItem.ShowQualityEffect(false, item.QualityEffect, image.transform);
|
||
}
|
||
|
||
var texts = newObj.GetComponentsInChildren<Text>();
|
||
for (var i = 0; i < texts.Length; i++)
|
||
{
|
||
if (texts[i].name == "Name") texts[i].text = item.Name;
|
||
if (texts[i].name == "Id1") texts[i].text = item.ClassID.ToString();
|
||
if (texts[i].name == "Id2") texts[i].text = item.SubClassID.ToString();
|
||
}
|
||
|
||
var itemId = item.Id;
|
||
var btn = newObj.GetComponentInChildren<Button>();
|
||
if (btn != null)
|
||
btn.onClick.AddListener(delegate
|
||
{
|
||
var num = 1;
|
||
if (m_inputNum != null) int.TryParse(m_inputNum.text, out num);
|
||
if (num <= 0)
|
||
num = 1;
|
||
var packet = (CG_GMCOMMAND) PacketDistributed.CreatePacket(MessageID.PACKET_CG_GMCOMMAND);
|
||
packet.Cmd = string.Format("item,{0},{1}", itemId, num);
|
||
packet.SendPacket();
|
||
});
|
||
}
|
||
}
|
||
|
||
public void ShowItems()
|
||
{
|
||
var items = TableManager.GetCommonItem().Values;
|
||
|
||
var classId = -1;
|
||
var subClassId = -1;
|
||
int.TryParse(m_ClassID.text, out classId);
|
||
int.TryParse(m_SubClassID.text, out subClassId);
|
||
if (classId == -1)
|
||
return;
|
||
for (var i = 0; i < m_clones.Count; i++)
|
||
{
|
||
m_clones[i].transform.SetParent(null);
|
||
m_clones[i].SetActive(false);
|
||
Destroy(m_clones[i]);
|
||
}
|
||
|
||
m_clones.Clear();
|
||
m_Clones.Clear();
|
||
foreach (var item in items)
|
||
if (item.ClassID == classId)
|
||
{
|
||
if (subClassId > 0)
|
||
if (item.SubClassID != subClassId)
|
||
continue;
|
||
var newObj = Instantiate(PetItemObj);
|
||
if (newObj == null)
|
||
continue;
|
||
newObj.SetActive(true);
|
||
newObj.transform.SetParent(PetItemObj.transform.parent);
|
||
newObj.transform.localPosition = Vector3.zero;
|
||
newObj.transform.localScale = PetItemObj.transform.localScale;
|
||
m_Clones[item.Name] = newObj;
|
||
m_clones.Add(newObj);
|
||
var image = newObj.GetComponentInChildren<Image>();
|
||
if (image != null)
|
||
{
|
||
LoadAssetBundle.Instance.SetImageSprite(image, item.Icon);
|
||
if (item.QualityEffect > 0)
|
||
CommonItemContainerItem.ShowQualityEffect(true, item.QualityEffect, image.transform);
|
||
else
|
||
CommonItemContainerItem.ShowQualityEffect(false, item.QualityEffect, image.transform);
|
||
}
|
||
|
||
var texts = newObj.GetComponentsInChildren<Text>();
|
||
for (var i = 0; i < texts.Length; i++)
|
||
{
|
||
if (texts[i].name == "Name") texts[i].text = item.Name;
|
||
if (texts[i].name == "Id1") texts[i].text = item.ClassID.ToString();
|
||
if (texts[i].name == "Id2") texts[i].text = item.SubClassID.ToString();
|
||
}
|
||
|
||
var itemId = item.Id;
|
||
var btn = newObj.GetComponentInChildren<Button>();
|
||
if (btn != null)
|
||
btn.onClick.AddListener(delegate
|
||
{
|
||
var num = 1;
|
||
if (m_inputNum != null) int.TryParse(m_inputNum.text, out num);
|
||
if (num <= 0)
|
||
num = 1;
|
||
var packet = (CG_GMCOMMAND) PacketDistributed.CreatePacket(MessageID.PACKET_CG_GMCOMMAND);
|
||
packet.Cmd = string.Format("item,{0},{1}", itemId, num);
|
||
packet.SendPacket();
|
||
});
|
||
}
|
||
}
|
||
|
||
//开启坐骑
|
||
public void OnOpenRideTestBtnClick()
|
||
{
|
||
var req = (CG_REQ_ADVANCE) PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ADVANCE);
|
||
req.SetOptionType((int) AdvanceBase.ReqType.ADVANCE_OPTION);
|
||
req.SetType((int) AdvanceBase.AdvanceType.Ride);
|
||
req.SetParam1(1); //自动购买
|
||
req.SetParam2(0);
|
||
|
||
req.SendPacket();
|
||
}
|
||
|
||
public void OpenAdvancepanel(int type)
|
||
{
|
||
var req = (CG_REQ_ADVANCE) PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ADVANCE);
|
||
req.SetOptionType((int) AdvanceBase.ReqType.ADVANCE_OPTION);
|
||
req.SetType(type);
|
||
req.SetParam1(1); //自动购买
|
||
req.SetParam2(0);
|
||
|
||
req.SendPacket();
|
||
|
||
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate(bool bSucess, object param)
|
||
{
|
||
if (bSucess) AdvanceMountPanelCtr.Instance.SetAdvanceType(type);
|
||
});
|
||
}
|
||
|
||
//婚姻入口
|
||
public void OnWeedingBtnClick()
|
||
{
|
||
UIManager.ShowUI(UIInfo.MarryRoot);
|
||
}
|
||
|
||
#region other
|
||
|
||
public InputField _SceneIDText;
|
||
public InputField _MenCntText;
|
||
public InputField _DifficultText;
|
||
|
||
public void CopySceneTest()
|
||
{
|
||
CommunityLogic.ShowMyCommunityRoot();
|
||
}
|
||
|
||
public void SkipGuide()
|
||
{
|
||
Guide.Instance.UpdateGuideID(100);
|
||
if (FunctionButtonLogic.Instance())
|
||
{
|
||
var btnFuncs = FunctionButtonLogic.Instance().gameObject.GetComponentsInChildren<BtnFunc>(true);
|
||
for (var i = 0; i < btnFuncs.Length; ++i) btnFuncs[i].UpdateFuncState();
|
||
}
|
||
|
||
if (FunctionExLogic.Instance())
|
||
{
|
||
var btnFuncs = FunctionExLogic.Instance().gameObject.GetComponentsInChildren<BtnFunc>(true);
|
||
for (var i = 0; i < btnFuncs.Length; ++i) btnFuncs[i].UpdateFuncState();
|
||
}
|
||
|
||
ExtraFunTipRoot.Instance().UpdateEquipEnhance();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region guide test
|
||
|
||
public InputField _GuideIDInput;
|
||
|
||
public void OnGuideTest()
|
||
{
|
||
var guideID = int.Parse(_GuideIDInput.text);
|
||
GuideLogic.StartGuide(guideID);
|
||
}
|
||
|
||
#endregion
|
||
} |