private void PshPower(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.PshPower) { return; } PshPower data = ne.scPacketBase as PshPower; PECommon.SetPlayerDataByPower(data); UGuiForm mainCityForm = GameEntry.UI.GetUIForm(UIFormId.MainCityForm); if (!mainCityForm) { return; } if (mainCityForm.Visible) { OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); } }
public void RefreshUI(object sender, GameEventArgs e) { OnRefreshUIFormEventArgs ne = e as OnRefreshUIFormEventArgs; if ((System.Object)sender != this && ne.formId != UIFormId.MainCityForm) { return; } PlayerData pd = PECommon.PlayerData; SetText(txtFight, PECommon.GetFightByProps(pd)); SetText(txtPower, "体力:" + pd.Power + "/" + PECommon.GetPowerLimit(pd.Lv)); imgPowerPrg.fillAmount = pd.Power * 1.0f / PECommon.GetPowerLimit(pd.Lv); SetText(txtLevel, pd.Lv); SetText(txtName, pd.Name); #region Expprg int expPrgVal = (int)(pd.Exp * 1.0f / PECommon.GetExpUpValByLv(pd.Lv) * 100); SetText(txtExpPrg, expPrgVal + "%"); int index = expPrgVal / 10; GridLayoutGroup grid = expPrgTrans.GetComponent <GridLayoutGroup>(); float globalRate = 1.0F * Constants.ScreenStandardHeight / Screen.height; float screenWidth = Screen.width * globalRate; float width = (screenWidth - 180) / 10; grid.cellSize = new Vector2(width, 7); for (int i = 0; i < expPrgTrans.childCount; i++) { Image img = expPrgTrans.GetChild(i).GetComponent <Image>(); if (i < index) { img.fillAmount = 1; } else if (i == index) { img.fillAmount = expPrgVal % 10 * 1.0f / 10; } else { img.fillAmount = 0; } } #endregion //设置自动任务图标 curtTaskData = GameEntry.Res.GetAutoGuideCfg(pd.Guideid); if (curtTaskData != null) { SetGuideBtnIcon(curtTaskData.npcID); } else { SetGuideBtnIcon(-1); } }
private void RefreshUI(object sender, GameEventArgs e) { OnRefreshUIFormEventArgs ne = e as OnRefreshUIFormEventArgs; if ((System.Object)sender != this && ne.formId != UIFormId.BattleEndForm) { return; } switch (endType) { case FBEndType.Pause: SetActive(rewardTrans, false); SetActive(btnExit.gameObject); SetActive(btnClose.gameObject); break; case FBEndType.Win: SetActive(rewardTrans, false); SetActive(btnExit.gameObject, false); SetActive(btnClose.gameObject, false); MapCfg cfg = GameEntry.Res.GetMapCfg(m_BattleEndFormData.Fbid); int min = m_BattleEndFormData.CostTime / 60; int sec = m_BattleEndFormData.CostTime % 60; int coin = cfg.coin; int exp = cfg.exp; int crystal = cfg.crystal; SetText(txtTime, "通关时间:" + min + ":" + sec); SetText(txtRestHP, "剩余血量:" + m_BattleEndFormData.RestHp); SetText(txtReward, "关卡奖励:" + Constants.Color(coin + "金币", TxtColor.Green) + Constants.Color(exp + "经验", TxtColor.Yellow) + Constants.Color(crystal + "水晶", TxtColor.Blue)); GameEntry.Timer.AddTimeTask((int tid) => { SetActive(rewardTrans); ani.Play(); GameEntry.Timer.AddTimeTask((int tid1) => { GameEntry.Sound.PlayUISound(Constants.FBItemEnter); GameEntry.Timer.AddTimeTask((int tid2) => { GameEntry.Sound.PlayUISound(Constants.FBItemEnter); GameEntry.Timer.AddTimeTask((int tid3) => { GameEntry.Sound.PlayUISound(Constants.FBItemEnter); GameEntry.Timer.AddTimeTask((int tid5) => { GameEntry.Sound.PlayUISound(Constants.FBItemEnter); }, 300); }, 270); }, 270); }, 325); }, 1000); break; case FBEndType.Lose: SetActive(rewardTrans, false); SetActive(btnExit.gameObject); SetActive(btnClose.gameObject, false); GameEntry.Sound.PlayUISound(Constants.FBLose); break; } }
private void UpdateUI(object sender, GameEventArgs e) { OnRefreshUIFormEventArgs ne = e as OnRefreshUIFormEventArgs; if (ne.formId != UIFormId.StrongForm) { return; } GameEntry.Sound.PlayUISound(Constants.FBItemEnter); ClickPosItem(currentIndex); }
public void PshTaskPrgs(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.PshTaskPrgs) { return; } PshTaskPrgs data = (PshTaskPrgs)ne.scPacketBase; PECommon.SetPlayerDataByTaskPsh(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.TaskForm); GameEntry.Event.FireNow(this, eventArgs); }
private void RspGuide(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspGuide) { return; } RspGuide data = (RspGuide)ne.scPacketBase; GameEntry.UI.AddTips(Constants.Color("任务奖励 金币+" + m_CurtTaskData.coin + " 经验+" + m_CurtTaskData.exp, TxtColor.Blue)); switch (m_CurtTaskData.actID) { case 0: //与智者对话 break; case 1: EnterFuben(); break; case 2: //进入强化界面 OpenStrongWnd(); break; case 3: //进入体力购买 OpenBuyWnd(0); break; case 4: //进入金币铸造 OpenBuyWnd(1); break; case 5: //进入世界聊天 OpenChatWnd(); break; } PECommon.SetPlayerDataByGuide(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.Fire(this, eventArgs); }
public void RefreshUI(object sender, GameEventArgs e) { OnRefreshUIFormEventArgs ne = e as OnRefreshUIFormEventArgs; if ((System.Object)sender != this && ne.formId != UIFormId.TaskForm) { return; } trdLst.Clear(); List <TaskRewardData> todoLst = new List <TaskRewardData>(); List <TaskRewardData> doneLst = new List <TaskRewardData>(); //1|0|0 for (int i = 0; i < m_TaskFormData.PlayerData.TaskArr.Count; i++) { string[] taskInfo = m_TaskFormData.PlayerData.TaskArr[i].Split('|'); TaskRewardData trd = new TaskRewardData { ID = int.Parse(taskInfo[0]), prgs = int.Parse(taskInfo[1]), taked = taskInfo[2].Equals("1") }; if (trd.taked) { doneLst.Add(trd); } else { todoLst.Add(trd); } } trdLst.AddRange(todoLst); trdLst.AddRange(doneLst); for (int i = 0; i < scrollTrans.childCount; i++) { Destroy(scrollTrans.GetChild(i).gameObject); } for (int i = 0; i < trdLst.Count; i++) { GameEntry.Res.LoadPrefab(PathDefine.TaskItemPrefab, LoadAssetSucessCallBack, LoadAssetFailCallBack, i); } }
private void RspBuy(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspBuy) { return; } RspBuy rspBuy = (RspBuy)ne.scPacketBase; PECommon.SetPlayerDataByBuy(rspBuy); GameEntry.UI.AddTips("购买成功"); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.Fire(this, eventArgs); GameEntry.UI.CloseUIForm(UIFormId.BuyForm); }
private void RspStrong(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspStrong) { return; } int zhanliPre = PECommon.GetFightByProps(PECommon.PlayerData); PECommon.SetPlayerDataByStrong((RspStrong)ne.scPacketBase); int zhanliNow = PECommon.GetFightByProps(PECommon.PlayerData); GameEntry.UI.AddTips(Constants.Color("战力提升 " + (zhanliNow - zhanliPre), TxtColor.Blue)); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.StrongForm); GameEntry.Event.FireNow(this, eventArgs); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); }
private void RspTakeTaskReward(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne == null) { return; } if (ne.msgID != CMD.RspTakeTaskReward) { return; } RspTakeTaskReward data = (RspTakeTaskReward)ne.scPacketBase; PECommon.SetPlayerDataByTask(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.TaskForm); GameEntry.Event.FireNow(this, eventArgs); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); }