public void OnChestClick(GameObject go) { if (isWarOver) { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_LTLegionWarQualifyController_13360")); return; } int index; int.TryParse(go.name, out index); GameChest chest = m_Chests[index]; if (chest.StageData.ReceiveState == eReceiveState.can) { m_CurrReceiveChest = chest; chest.UpdateReceiveState(eReceiveState.have); SendReceiveRewardReq(chest.StageData); return; } string tip = ""; if (chest.StageData.ReceiveState == eReceiveState.cannot) { tip = string.Format(EB.Localizer.GetString("ID_codefont_in_LTLegionWarQualifyController_13908"), chest.StageData.Stage); } else if (chest.StageData.ReceiveState == eReceiveState.have) { tip = EB.Localizer.GetString("ID_codefont_in_LadderController_11750"); } var ht = Johny.HashtablePool.Claim(); ht.Add("data", chest.StageData.Awards); ht.Add("tip", tip); GlobalMenuManager.Instance.Open("LTRewardShowUI", ht); }
public override void Awake() { base.Awake(); var t = controller.transform; slideTween = t.GetComponent <TweenPosition>("ScoreBoard/Container/MotionFrame"); ScoreBoardArrow = t.GetComponent <UISprite>("ScoreBoard/Container/MotionFrame/Btn/arrow"); ScoreBoardDynamicScroll = t.GetMonoILRComponent <ScoreBoardDynamicScroll>("ScoreBoard/Container/MotionFrame/Scroll View/Placeholder/Grid"); PlayerItem = t.GetMonoILRComponent <ScoreBoardCell>("ScoreBoard/Container/MotionFrame/PlayerItem"); TimeLabel = t.GetComponent <UILabel>("Edge/Top/Time"); EndLabel = t.GetComponent <UILabel>("Edge/Top/End"); BGTexture = t.GetComponent <CampaignTextureCmp>("BG"); CloseBg = t.FindEx("ScoreBoard/Container/CloseBg").gameObject; m_LivenessProgressBar = t.GetComponent <UIProgressBar>("Edge/LivenessReward/ProgressBar"); m_CurrLivenessLabel = t.GetComponent <UILabel>("Edge/LivenessReward/Score"); ActivityId = 10001; controller.backButton = t.GetComponent <UIButton>("Edge/BG/TopLeft/CancelBtn"); t.GetComponent <UIButton>("Edge/BG/Chat").onClick.Add(new EventDelegate(OnChatBtnClick)); t.GetComponent <UIButton>("Edge/BG/Friend").onClick.Add(new EventDelegate(OnFriendBtnClick)); t.GetComponent <UIButton>("Edge/LivenessReward/0").onClick.Add(new EventDelegate(() => OnChestClick(t.FindEx("Edge/LivenessReward/0").gameObject))); t.GetComponent <UIButton>("Edge/LivenessReward/1").onClick.Add(new EventDelegate(() => OnChestClick(t.FindEx("Edge/LivenessReward/1").gameObject))); t.GetComponent <UIButton>("Edge/LivenessReward/2").onClick.Add(new EventDelegate(() => OnChestClick(t.FindEx("Edge/LivenessReward/2").gameObject))); t.GetComponent <UIButton>("ScoreBoard/Container/MotionFrame/Btn").onClick.Add(new EventDelegate(OnScoreBoardBtnClick)); t.GetComponent <UIEventTrigger>("ScoreBoard/Container/CloseBg").onClick.Add(new EventDelegate(OnScoreBoardBtnClick)); m_Chests = new GameChest[3]; for (int chestIndex = 0; chestIndex < m_Chests.Length; ++chestIndex) { m_Chests[chestIndex] = new GameChest(); m_Chests[chestIndex].Open = t.FindEx("Edge/LivenessReward/" + chestIndex + "/Open").gameObject; m_Chests[chestIndex].UnOpen = t.FindEx("Edge/LivenessReward/" + chestIndex + "/Close").gameObject; m_Chests[chestIndex].Light = t.FindEx("Edge/LivenessReward/" + chestIndex + "/Light").gameObject; m_Chests[chestIndex].Value = t.GetComponent <UILabel>("Edge/LivenessReward/" + chestIndex + "/ActivityNum"); m_Chests[chestIndex].OriginPos = Vector3.zero; m_Chests[chestIndex].OriginPos = m_Chests[chestIndex].UnOpen.transform.localPosition; } FlowEnemyHudList = new FlowEnemyHud[7]; FlowEnemyHudList[0] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud"); FlowEnemyHudList[1] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (1)"); FlowEnemyHudList[2] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (2)"); FlowEnemyHudList[3] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (3)"); FlowEnemyHudList[4] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (4)"); FlowEnemyHudList[5] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (5)"); FlowEnemyHudList[6] = t.GetMonoILRComponent <FlowEnemyHud>("FlowEnemyHud/Root/FlowEnemyHud (6)"); }
private void InitView() { mDL.DataIDList.Add("user_prize_data.taskacm"); m_ChestRoot = mDL.transform.Find("AchievementReward").gameObject; m_ProgressLabel = mDL.transform.Find("AchievementReward/ProgressBar/Label").GetComponent <UILabel>(); m_AchievementProgressBar = mDL.transform.Find("AchievementReward/ProgressBar").GetComponent <UIProgressBar>(); m_ReceiveChestRequest = mDL.transform.Find("AchievementReward/ReceiveChestReq").GetComponent <UIServerRequest>(); m_ReceiveChestRequest.onResponse.Add(new EventDelegate(mDL, "OnFetchData")); UIButton HotfixBtn0 = mDL.transform.Find("AchievementReward/Box").GetComponent <UIButton>(); HotfixBtn0.onClick.Add(new EventDelegate(OnChestClick)); m_Chest = new GameChest(); m_Chest.Open = mDL.transform.Find("AchievementReward/Box/OpenTag").gameObject; m_Chest.UnOpen = mDL.transform.Find("AchievementReward/Box/Close").gameObject; m_Chest.Light = mDL.transform.Find("AchievementReward/Box/Light").gameObject; }
public void OnChestClick(GameObject go) { FusionAudio.PostEvent("UI/General/ButtonClick"); int index; //去掉判断是否是每周宝箱 int.TryParse(go.name, out index); GameChest chest = m_Chests[index]; if (chest.StageData.ReceiveState == eReceiveState.can) { m_CurrReceiveChest = chest; chest.UpdateReceiveState(eReceiveState.have); if (mTaskType == eTaskType.Week) { SendReceiveWeekRewardReq(chest.StageData); } else { SendReceiveRewardReq(chest.StageData); } return; } string tip = ""; if (chest.StageData.ReceiveState == eReceiveState.cannot) { tip = string.Format(EB.Localizer.GetString("ID_codefont_in_TaskNormalLivenessLogic_3701"), chest.StageData.Stage); } else if (chest.StageData.ReceiveState == eReceiveState.have) { tip = EB.Localizer.GetString("ID_codefont_in_LadderController_11750"); } var ht = Johny.HashtablePool.Claim(); ht.Add("data", chest.StageData.Awards); ht.Add("tip", tip); GlobalMenuManager.Instance.Open("LTRewardShowUI", ht); }
public override void Awake() { base.Awake(); mTaskType = mDL.DefaultDataID == "user_prize_data.taskweekliveness" ? eTaskType.Week : eTaskType.Normal; m_ChestRoot = mDL.transform.Find("LivenessReward").gameObject; m_CurrLivenessLabel = mDL.transform.Find("LivenessReward/Flag/Liveness").GetComponent <UILabel>(); m_LivenessProgressBar = mDL.transform.Find("LivenessReward/ProgressBar").GetComponent <UIProgressBar>(); m_ReceiveChestRequest = mDL.transform.Find("LivenessReward/ReceiveChestReq").GetComponent <UIServerRequest>(); m_ReceiveChestRequest.onResponse.Add(new EventDelegate(mDL, "OnFetchData")); m_ReceiveWeekChestRequest = mDL.transform.Find("LivenessReward/ReceiveWeekChestReq").GetComponent <UIServerRequest>(); m_ReceiveWeekChestRequest.onResponse.Add(new EventDelegate(mDL, "OnFetchData")); m_ProgressBarLeftPos = mDL.transform.Find("LivenessReward/ProgressBar/LeftPosition"); m_ProgressBarRightPos = mDL.transform.Find("LivenessReward/ProgressBar/RightPosition"); ActivityId = mTaskType == eTaskType.Week?7201:7101; m_Chests = new GameChest[5]; m_Chests[0] = new GameChest(); m_Chests[0].Open = mDL.transform.Find("LivenessReward/0/Open").gameObject; m_Chests[0].UnOpen = mDL.transform.Find("LivenessReward/0/Close").gameObject; m_Chests[0].Light = mDL.transform.Find("LivenessReward/0/Light").gameObject; m_Chests[0].Value = mDL.transform.Find("LivenessReward/0/ActivityNum").GetComponent <UILabel>(); m_Chests[1] = new GameChest(); m_Chests[1].Open = mDL.transform.Find("LivenessReward/1/Open").gameObject; m_Chests[1].UnOpen = mDL.transform.Find("LivenessReward/1/Close").gameObject; m_Chests[1].Light = mDL.transform.Find("LivenessReward/1/Light").gameObject; m_Chests[1].Value = mDL.transform.Find("LivenessReward/1/ActivityNum").GetComponent <UILabel>(); m_Chests[2] = new GameChest(); m_Chests[2].Open = mDL.transform.Find("LivenessReward/2/Open").gameObject; m_Chests[2].UnOpen = mDL.transform.Find("LivenessReward/2/Close").gameObject; m_Chests[2].Light = mDL.transform.Find("LivenessReward/2/Light").gameObject; m_Chests[2].Value = mDL.transform.Find("LivenessReward/2/ActivityNum").GetComponent <UILabel>(); m_Chests[3] = new GameChest(); m_Chests[3].Open = mDL.transform.Find("LivenessReward/3/Open").gameObject; m_Chests[3].UnOpen = mDL.transform.Find("LivenessReward/3/Close").gameObject; m_Chests[3].Light = mDL.transform.Find("LivenessReward/3/Light").gameObject; m_Chests[3].Value = mDL.transform.Find("LivenessReward/3/ActivityNum").GetComponent <UILabel>(); m_Chests[4] = new GameChest(); m_Chests[4].Open = mDL.transform.Find("LivenessReward/4/Open").gameObject; m_Chests[4].UnOpen = mDL.transform.Find("LivenessReward/4/Close").gameObject; m_Chests[4].Light = mDL.transform.Find("LivenessReward/4/Light").gameObject; m_Chests[4].Value = mDL.transform.Find("LivenessReward/4/ActivityNum").GetComponent <UILabel>(); HotfixBtn0 = mDL.transform.Find("LivenessReward/0").GetComponent <UIButton>(); HotfixBtn0.onClick.Add(new EventDelegate(() => { OnChestClick(HotfixBtn0.gameObject); })); HotfixBtn1 = mDL.transform.Find("LivenessReward/1").GetComponent <UIButton>(); HotfixBtn1.onClick.Add(new EventDelegate(() => { OnChestClick(HotfixBtn1.gameObject); })); HotfixBtn2 = mDL.transform.Find("LivenessReward/2").GetComponent <UIButton>(); HotfixBtn2.onClick.Add(new EventDelegate(() => { OnChestClick(HotfixBtn2.gameObject); })); HotfixBtn3 = mDL.transform.Find("LivenessReward/3").GetComponent <UIButton>(); HotfixBtn3.onClick.Add(new EventDelegate(() => { OnChestClick(HotfixBtn3.gameObject); })); HotfixBtn4 = mDL.transform.Find("LivenessReward/4").GetComponent <UIButton>(); HotfixBtn4.onClick.Add(new EventDelegate(() => { OnChestClick(HotfixBtn4.gameObject); })); m_LivenessProgressBar.value = 0f; m_ChestRoot.CustomSetActive(false); for (int chestIndex = 0; chestIndex < m_Chests.Length; ++chestIndex) { m_Chests[chestIndex].OriginPos = m_Chests[chestIndex].UnOpen.transform.localPosition; } }