private void UpdatePlayerBirthdayRefresh(int obj)
    {
        var refreshTimeStamp =
            _missionModel.GetPlayerBirthdayRefreshTimePointList()[_missionModel.GetPlayerBirthdayOpenDay()];
        var curTimeStamp  = ClientTimer.Instance.GetCurrentTimeStamp();
        var overTimeStamp = _missionModel.GetPlayerBirthdayOverTimeStamp();

        if (curTimeStamp == overTimeStamp)
        {
            ModuleManager.Instance.GoBack();
            return;
        }

        if (refreshTimeStamp == curTimeStamp)
        {
            MissionRefreshReq req = new MissionRefreshReq();
            var data = NetWorkManager.GetByteData(req);
            NetWorkManager.Instance.Send <MissionRefreshRes>(CMD.MISSION_REFRESH, data, res =>
            {
                _missionModel.UpdateUserMissionInfo(res.UserMissionInfo);
                _missionModel.UpdatePlayerBirthdayMission(res.UserMissions);

                _missionModel.PlayerBirthdayMissionsDay = _missionModel.GetPlayerBirthdayOpenDay();
                View.SetData(_missionModel, _missionModel.PlayerBirthdayMissionsDay);
            });
        }
    }
Example #2
0
    private void SetToggleState(int day)
    {
        var openDay = _missionModel.GetPlayerBirthdayOpenDay();

        if (openDay >= _togglesTran.childCount)
        {
            openDay = _togglesTran.childCount;
        }

        for (int i = 0; i < _togglesTran.childCount; i++)
        {
            var toggleTra = _togglesTran.GetChild(i);
            var toggleDay = int.Parse(toggleTra.gameObject.name);
            if (toggleDay <= openDay)           //开放
            {
                toggleTra.Find("Mask").gameObject.Hide();
                if (day == toggleDay)
                {
                    var isOn = toggleTra.GetChild(0).GetComponent <Toggle>().isOn;
                    if (!isOn)
                    {
                        toggleTra.GetChild(0).GetComponent <Toggle>().isOn = true;
                    }

                    toggleTra.GetChild(0).Find("Star1").gameObject.Show();
                    toggleTra.GetChild(0).Find("Star2").gameObject.Hide();
                }
                else
                {
                    var isOn = toggleTra.GetChild(0).GetComponent <Toggle>().isOn;
                    if (isOn)
                    {
                        toggleTra.GetChild(0).GetComponent <Toggle>().isOn = false;
                    }
                    toggleTra.GetChild(0).Find("Star1").gameObject.Hide();
                    toggleTra.GetChild(0).Find("Star2").gameObject.Show();
                }
            }
            else             //没开放
            {
                toggleTra.Find("Mask").gameObject.Show();
                toggleTra.Find("Red").gameObject.Hide();

                toggleTra.GetChild(0).GetComponent <Toggle>().interactable = false;
                toggleTra.GetChild(0).GetComponent <Toggle>().isOn         = false;
                toggleTra.GetChild(0).Find("Star1").gameObject.Hide();
                toggleTra.GetChild(0).Find("Star2").gameObject.Show();
            }
        }
    }