void OnBtnSign() { //WGGameUIView.Instance.ViewControllerDoAct(BTN_ACT.Sign); int curday = Core.now.DayOfYear; int lastDay = _DataPlayer.lastDailyRewardTime.DayOfYear; bool signed = false; if (curday == lastDay) { signed = true; } else { signed = false; } WGDailyRewardView rewardView = WGDailyRewardView.CreateDailyView(signed); if (curday > lastDay + 1) { _DataPlayer.ContinuousDay = 0; DataPlayerController.getInstance().saveDataPlayer(); } if (signed) { rewardView.freshWithDailyReward(_DataPlayer.ContinuousDay, signed); } else { if (_DataPlayer.ContinuousDay >= 7) { _DataPlayer.ContinuousDay = 0; DataPlayerController.getInstance().saveDataPlayer(); } rewardView.freshWithDailyReward(_DataPlayer.ContinuousDay, signed); } rewardView.alertViewBehavriour = (ab, view) => { freshSign(); switch (ab) { case MDAlertBehaviour.CLICK_OK: view.hiddenView(); _DataPlayer.ContinuousDay++; //if(_DataPlayer.ContinuousDay>7)_DataPlayer.ContinuousDay = 0; DataPlayerController.getInstance().saveDataPlayer(); break; case MDAlertBehaviour.DID_HIDDEN: Destroy(view.gameObject); WGAlertManager.Self.RemoveHeadAndShowNext(); break; } }; BCSoundPlayer.Play(MusicEnum.showReward, 1f); rewardView.showView(); }
public static WGDailyRewardView CreateDailyView(bool signed = false) { Object obj = Resources.Load("pbWGDailyRewardView"); GameObject go = Instantiate(obj) as GameObject; WGDailyRewardView drv = go.GetComponent <WGDailyRewardView>(); SDK.AddChild(go, WGRootManager.Self.goRootTopUI); drv.InitDailyView(signed); return(drv); }