void OnNextHero() { heroIdx += 1; if (heroIdx >= Main.Ins.DataMgr.GetDatasArray <ModelDatas.ModelDatas>().Count) { heroIdx = 0; } heroImg.material = ResMng.Load(string.Format("Hero{0}", heroIdx)) as Material; }
void OnPrevHero() { heroIdx -= 1; if (heroIdx < 0) { heroIdx = Main.Ins.DataMgr.GetDatasArray <ModelDatas.ModelDatas>().Count - 1; } heroImg.material = ResMng.Load(string.Format("Hero{0}", heroIdx)) as Material; }
void OnPrevWeapon() { weaponIdx -= 1; if (weaponIdx < 0) { weaponIdx = 11; } weaponImg.material = ResMng.Load(string.Format("Weapon_{0}", weaponIdx)) as Material; }
void OnNextWeapon() { weaponIdx += 1; if (weaponIdx >= 12) { weaponIdx = 0; } weaponImg.material = ResMng.Load(string.Format("Weapon_{0}", weaponIdx)) as Material; }
void Init() { inputChat = Control("ChatText", WndObject).GetComponent <InputField>(); Control("SendShortMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer) { string chatMessage = inputChat.text; if (string.IsNullOrEmpty(inputChat.text)) { U3D.PopupTip("无法发送内容为空的语句"); return; } Common.SendChatMessage(chatMessage); } }); Control("CloseQuickMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); Control("CloseShortMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); Control("CloseAudioMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); if (jsData == null) { TextAsset text = ResMng.Load("MsgTable") as TextAsset; jsData = LitJson.JsonMapper.ToObject(text.text); } for (int i = 0; i < jsData["Msg"].Count; i++) { string strQuick = jsData["Msg"][i].ToString(); Control(i.ToString(), WndObject).GetComponentInChildren <Text>().text = strQuick; int j = i; Control(i.ToString(), WndObject).GetComponent <Button>().onClick.AddListener(() => { SendQuickMsg(j); }); } Control("Record", WndObject).GetComponent <Button>().onClick.AddListener(() => { Record(); }); Control("SendAudio", WndObject).GetComponent <Button>().onClick.AddListener(() => { SendAudioMsg(); }); GameObject objListen = Control("Listen", WndObject); source = objListen.GetComponent <AudioSource>(); Listen = objListen.GetComponent <Button>(); Listen.onClick.AddListener(() => { if (MicChat.clip != null) { source.PlayOneShot(MicChat.clip); } Debug.Log("play clip"); }); CountDown = Control("CountDown", WndObject); }
void Init() { heroImg = Control("Image").GetComponent <Image>(); heroImg.material = ResMng.Load("Hero0") as Material; Control("Next").GetComponent <Button>().onClick.AddListener(() => { OnNextHero(); U3D.PlayBtnAudio(); }); Control("Prev").GetComponent <Button>().onClick.AddListener(() => { OnPrevHero(); U3D.PlayBtnAudio(); }); Control("Select").GetComponent <UIButtonExtended>().onClick.AddListener(() => { OnSelectHero(); U3D.PlayBtnAudio(); }); }
void InsertServerItem(ServerInfo svr, int i) { GameObject btn = GameObject.Instantiate(ResMng.Load("ButtonNormal")) as GameObject; btn.transform.SetParent(serverRoot.transform); btn.transform.localScale = Vector3.one; btn.transform.localPosition = Vector3.zero; btn.transform.localRotation = Quaternion.identity; btn.GetComponent <Button>().onClick.AddListener(() => { if (Main.Ins.CombatData.Server == Main.Ins.CombatData.Servers[i]) { TcpClientProxy.CheckNeedReConnect(); return; } TcpClientProxy.Exit(); ClearRooms(); Main.Ins.CombatData.Server = svr; TcpClientProxy.ReStart(); }); btn.GetComponentInChildren <Text>().text = svr.ServerName; }
void InsertDlc(Chapter item) { if (prefabPluginWnd == null) { prefabPluginWnd = ResMng.Load("PluginWnd") as GameObject; } GameObject insert = GameObject.Instantiate(prefabPluginWnd); insert.transform.SetParent(PluginRoot.transform); insert.transform.localPosition = Vector3.zero; insert.transform.localScale = Vector3.one; insert.transform.localRotation = Quaternion.identity; PluginCtrl ctrl = insert.GetComponent <PluginCtrl>(); if (ctrl != null) { ctrl.AttachDlc(item); if (!Main.Ins.GameStateMgr.gameStatus.IsDlcInstalled(item)) { Main.Ins.DlcMng.AddPreviewTask(ctrl); } } pluginList.Add(ctrl); }