少年修仙传客户端代码仓库
4435 子 【开发】【1.2.0】功能预告界面修改,新增可领取奖励 / 【前端】【1.2.0】功能预告界面修改,新增可领取奖励
3个文件已修改
459 ■■■■■ 已修改文件
System/MainInterfacePanel/FeatureNotice2Win.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeatureNoticeModel.cs 358 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeaturesType3.cs 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeatureNotice2Win.cs
@@ -22,6 +22,7 @@
        [SerializeField] FeatureNoticeTip m_FeatureNoticeTip;
        [SerializeField] ScaleTween m_ScaleTween;
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        public int Offset = 0;//偏移
        private bool IsJump = false;
        #region Built-in
        protected override void BindController()
@@ -53,16 +54,28 @@
            {
                m_ScaleTween.SetEndState();
            }
        }
            featureNoticeModel.UpdateAwarfItem += UpdateAwarfItem;
        }
        private void UpdateAwarfItem()
        {
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        }
        protected override void OnPreClose()
        {
        }
        protected override void OnAfterClose()
        {
            featureNoticeModel.UpdateAwarfItem -= UpdateAwarfItem;
        }
        protected override void OnActived()
        {
            var offset = 0f;
            m_ScrollerController.JumpIndex(JumpIndex(), ref offset);
            m_ScrollerController.JumpIndex(Offset + offset, 0, EnhancedScroller.TweenType.immediate);
        }
        private void OnClickBtn()
        {
            if (!WindowJumpMgr.Instance.IsJumpState)//是否经历跳
@@ -134,6 +147,28 @@
            }
        }
        private int JumpIndex()//Jump选中
        {
            int Index = 0;
            for (int i = 0; i < featureNoticeModel.FunctionList.Count; i++)
            {
                int funcID = featureNoticeModel.FunctionList[i].FuncId;
                if (featureNoticeModel.DicRedPoint.ContainsKey(funcID) && featureNoticeModel.DicRedPoint[funcID].state==RedPointState.Simple)
                {
                    Index = i;
                    return Index;
                }
            }
            Index = featureNoticeModel.FunctionList.FindIndex((x) =>
            {
                return x.FuncId == featureNoticeModel.FunctionForecastIndex;
            });
            if (Index == -1)
            {
                Index = 0;
            }
            return Index;
        }
        #endregion
    }
System/MainInterfacePanel/FeatureNoticeModel.cs
@@ -15,7 +15,8 @@
{
    public List<FunctionForecastConfig> FunctionList = new List<FunctionForecastConfig>();
    public Dictionary<int, ImpactRankModel.RankAwardItem> DicAwardItem = new Dictionary<int, ImpactRankModel.RankAwardItem>();//奖励物品
    public  Dictionary<int, OpenFuncState> DicOpenFuncState = new Dictionary<int, OpenFuncState>();
    public Dictionary<int, OpenFuncState> DicOpenFuncState = new Dictionary<int, OpenFuncState>();
    public Dictionary<int, Redpoint> DicRedPoint = new Dictionary<int, Redpoint>();//红点
    public event Action UpdateAwarfItem;
    private const int Redpoint_key1 = 38;
    public Redpoint redPointStre1 = new Redpoint(Redpoint_key1);
@@ -27,28 +28,30 @@
    {
        AddList();
        AddAwardItem();
        AddRedPoint();
    }
    public void OnBeforePlayerDataInitialize()
    {
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayersUpLV;
        FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
        treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
        treasureModel.treasureStageUpEvent -= treasureStageUpEvent;
        //PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayersUpLV;
        //FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
        //treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
        //treasureModel.treasureStageUpEvent -= treasureStageUpEvent;
    }
    public void OnPlayerLoginOk()
    {
        FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayersUpLV;
        treasureModel.treasureStateChangeEvent += treasureStateChangeEvent;
        treasureModel.treasureStageUpEvent += treasureStageUpEvent;
    {
        //FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
        //PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayersUpLV;
        //treasureModel.treasureStateChangeEvent += treasureStateChangeEvent;
        //treasureModel.treasureStageUpEvent += treasureStageUpEvent;
        StageManager.Instance.onStageLoadFinish -= OnStageLoadFinish;
        StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
        RedDotStatus();
        RedPoint_State();
        // RedDotStatus();
    }
    public override void UnInit()
    {
@@ -62,29 +65,29 @@
            RedPointChange = false;
            IsRedPoint = false;
        }
    }
    private void treasureStageUpEvent(int obj)
    {
        RedDotStatus();
    }
    //private void treasureStageUpEvent(int obj)
    //{
    //    RedDotStatus();
    //}
    private void treasureStateChangeEvent(int obj)
    {
        RedDotStatus();
    }
    //private void treasureStateChangeEvent(int obj)
    //{
    //    RedDotStatus();
    //}
    private void OnFuncStateChangeEvent(int obj)
    {
        RedDotStatus();
    }
    //private void OnFuncStateChangeEvent(int obj)
    //{
    //    RedDotStatus();
    //}
    private void OnPlayersUpLV(PlayerDataRefresh obj)
    {
        if (obj == PlayerDataRefresh.LV)
        {
            RedDotStatus();
        }
    }
    //private void OnPlayersUpLV(PlayerDataRefresh obj)
    //{
    //    if (obj == PlayerDataRefresh.LV)
    //    {
    //        RedDotStatus();
    //    }
    //}
    private void AddList()//添加列表信息
    {
        if (FunctionList.Count <= 0)
@@ -109,7 +112,7 @@
            foreach (var key in configs)
            {
                var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(key);
                if (!DicAwardItem.ContainsKey(functionForecastConfig.FuncId) && functionForecastConfig.Display==1)
                if (!DicAwardItem.ContainsKey(functionForecastConfig.FuncId) && functionForecastConfig.Display == 1)
                {
                    ImpactRankModel.RankAwardItem _award = new ImpactRankModel.RankAwardItem();
                    if (functionForecastConfig.Award == string.Empty)
@@ -133,148 +136,182 @@
                    DicAwardItem.Add(functionForecastConfig.FuncId, _award);
                }
            }
          //  DebugEx.LogError(DicAwardItem);
            //  DebugEx.LogError(DicAwardItem);
        }
    }
    private void RedDotStatus()
    private void AddRedPoint()
    {
        for (int i = 0; i < FunctionList.Count; i++)
        if (DicRedPoint.Count <= 0)
        {
            if (!FuncOpen.Instance.IsFuncOpen(FunctionList[i].FuncId))
            var configs = Config.Instance.GetAllKeys<FunctionForecastConfig>();
            foreach (var key in configs)
            {
                redPointStre1.state = RedPointState.None;
                if (OpenFuncId != FunctionList[i].FuncId)
                var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(key);
                if (!DicRedPoint.ContainsKey(functionForecastConfig.FuncId) && functionForecastConfig.Display == 1)
                {
                    RedPointChange = false;
                    int RedPointkey = Redpoint_key1 * 10000 + functionForecastConfig.FuncId;
                    Redpoint redPointMountStare = new Redpoint(Redpoint_key1, RedPointkey);
                    DicRedPoint.Add(functionForecastConfig.FuncId, redPointMountStare);
                }
                if (OpenFuncId != FunctionList[i].FuncId || !RedPointChange)
                {
                    OpenFuncId = FunctionList[i].FuncId;
                    IsRedPoint = false;
                    TrailerClassification(FunctionList[i].FuncId);
                }
                return;
            }
        }
    }
    private void TrailerClassification(int funcID)
    private void RedPoint_State()
    {
        FuncOpenLVConfig funcoPenConfig = Config.Instance.Get<FuncOpenLVConfig>(funcID);
        var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
        if (funcoPenConfig.LimitMagicWeapon != 0 || funcoPenConfig.LimitMissionID != 0)
        var configs = Config.Instance.GetAllKeys<FunctionForecastConfig>();
        foreach (var key in DicRedPoint.Keys)
        {
            if (funcoPenConfig.LimitMagicWeapon != 0)//法宝
            {
                int faBaoID = funcoPenConfig.LimitMagicWeapon / 100;
                MagicWeapon(faBaoID, funcID);
                return;
            }
            else if (funcoPenConfig.LimitMissionID != 0)//任务
            {
                if (functionForecastConfig.RedPointLV <= 0)
                {
                    return;
                }
                if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
                {
                    RedPointChange = true;
                    IsRedPoint = true;
                }
                if (IsRedPoint)
                {
                    redPointStre1.state = RedPointState.Simple;
                }
                else
                {
                    redPointStre1.state = RedPointState.None;
                }
                return;
            }
            DicRedPoint[key].state=RedPointState.None;
        }
        else//等级
        foreach (var _key in DicOpenFuncState.Keys)
        {
            if (functionForecastConfig.RedPointLV <= 0)
            if (DicRedPoint.ContainsKey(_key) && DicOpenFuncState[_key].State==1
                && DicOpenFuncState[_key].AwardState==0)
            {
                return;
                DicRedPoint[_key].state = RedPointState.Simple;
            }
            if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
            {
                RedPointChange = true;
                IsRedPoint = true;
            }
            if (IsRedPoint)
            {
                redPointStre1.state = RedPointState.Simple;
            }
            else
            {
                redPointStre1.state = RedPointState.None;
            }
            return;
        }
    }
    //private void RedDotStatus()//红点1
    //{
    //    for (int i = 0; i < FunctionList.Count; i++)
    //    {
    //        if (!FuncOpen.Instance.IsFuncOpen(FunctionList[i].FuncId))
    //        {
    //            redPointStre1.state = RedPointState.None;
    //            if (OpenFuncId != FunctionList[i].FuncId)
    //            {
    //                RedPointChange = false;
    //            }
    //            if (OpenFuncId != FunctionList[i].FuncId || !RedPointChange)
    //            {
    //                OpenFuncId = FunctionList[i].FuncId;
    //                IsRedPoint = false;
    //                TrailerClassification(FunctionList[i].FuncId);
    //            }
    //            return;
    //        }
    //    }
    //}
    //private void TrailerClassification(int funcID)//红点1
    //{
    //    FuncOpenLVConfig funcoPenConfig = Config.Instance.Get<FuncOpenLVConfig>(funcID);
    //    var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
    //    if (funcoPenConfig.LimitMagicWeapon != 0 || funcoPenConfig.LimitMissionID != 0)
    //    {
    //        if (funcoPenConfig.LimitMagicWeapon != 0)//法宝
    //        {
    //            int faBaoID = funcoPenConfig.LimitMagicWeapon / 100;
    //            MagicWeapon(faBaoID, funcID);
    //            return;
    //        }
    //        else if (funcoPenConfig.LimitMissionID != 0)//任务
    //        {
    //            if (functionForecastConfig.RedPointLV <= 0)
    //            {
    //                return;
    //            }
    //            if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
    //            {
    //                RedPointChange = true;
    //                IsRedPoint = true;
    //            }
    //            if (IsRedPoint)
    //            {
    //                redPointStre1.state = RedPointState.Simple;
    //            }
    //            else
    //            {
    //                redPointStre1.state = RedPointState.None;
    //            }
    //            return;
    //        }
    //    }
    //    else//等级
    //    {
    //        if (functionForecastConfig.RedPointLV <= 0)
    //        {
    //            return;
    //        }
    //        if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
    //        {
    //            RedPointChange = true;
    //            IsRedPoint = true;
    //        }
    //        if (IsRedPoint)
    //        {
    //            redPointStre1.state = RedPointState.Simple;
    //        }
    //        else
    //        {
    //            redPointStre1.state = RedPointState.None;
    //        }
    //        return;
    //    }
    //}
    TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
    private void MagicWeapon(int fabaoID, int funcID)
    {
        var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
        if (functionForecastConfig.RedPointLV > 0)//根据填的等级来
        {
            if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
            {
                RedPointChange = true;
                IsRedPoint = true;
            }
            if (IsRedPoint)
            {
                redPointStre1.state = RedPointState.Simple;
            }
            else
            {
                redPointStre1.state = RedPointState.None;
            }
            return;
        }
        Treasure treasure;//根据解锁法宝的百分比
    //private void MagicWeapon(int fabaoID, int funcID)//红点1
    //{
    //    var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
    //    if (functionForecastConfig.RedPointLV > 0)//根据填的等级来
    //    {
    //        if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
    //        {
    //            RedPointChange = true;
    //            IsRedPoint = true;
    //        }
    //        if (IsRedPoint)
    //        {
    //            redPointStre1.state = RedPointState.Simple;
    //        }
    //        else
    //        {
    //            redPointStre1.state = RedPointState.None;
    //        }
    //        return;
    //    }
    //    Treasure treasure;//根据解锁法宝的百分比
        if (treasureModel.TryGetTreasure(fabaoID, out treasure)
              && treasure.state == TreasureState.Collected)
        {
            var list = treasure.treasureStages;
            var funcStage = 0;
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].unlockType == TreasureStageUnlock.Func &&
                    list[i].func == funcID)
                {
                    funcStage = i;
                    break;
                }
            }
            if (treasure.stage == funcStage - 1 || funcStage == 0)
            {
                float exp = ((float)treasure.exp / treasure.treasureStages[funcStage].exp) * 100;
                if (functionForecastConfig.RedPointPercentage > -1)
                {
                    if (exp >= functionForecastConfig.RedPointPercentage)
                    {
                        RedPointChange = true;
                        IsRedPoint = true;
                    }
                    if (IsRedPoint)
                    {
                        redPointStre1.state = RedPointState.Simple;
                    }
                }
                else
                {
                    redPointStre1.state = RedPointState.None;
                }
            }
        }
    }
    //    if (treasureModel.TryGetTreasure(fabaoID, out treasure)
    //          && treasure.state == TreasureState.Collected)
    //    {
    //        var list = treasure.treasureStages;
    //        var funcStage = 0;
    //        for (int i = 0; i < list.Count; i++)
    //        {
    //            if (list[i].unlockType == TreasureStageUnlock.Func &&
    //                list[i].func == funcID)
    //            {
    //                funcStage = i;
    //                break;
    //            }
    //        }
    //        if (treasure.stage == funcStage - 1 || funcStage == 0)
    //        {
    //            float exp = ((float)treasure.exp / treasure.treasureStages[funcStage].exp) * 100;
    //            if (functionForecastConfig.RedPointPercentage > -1)
    //            {
    //                if (exp >= functionForecastConfig.RedPointPercentage)
    //                {
    //                    RedPointChange = true;
    //                    IsRedPoint = true;
    //                }
    //                if (IsRedPoint)
    //                {
    //                    redPointStre1.state = RedPointState.Simple;
    //                }
    //            }
    //            else
    //            {
    //                redPointStre1.state = RedPointState.None;
    //            }
    //        }
    //    }
    //}
    public IEnumerator WhetherToPlayTheBox()
    {
@@ -305,11 +342,11 @@
                if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.FrameLevel && type == 0)
                {
                    LocalSave.SetInt(strKey, functionForecastConfig.FrameLevel);
                   var IsOpenFeatureNotice = WindowCenter.Instance.IsOpen<FeatureNoticeWin>();
                   var IsOpenFeatureNotice = WindowCenter.Instance.IsOpen<FeatureNotice2Win>();
                    if (!IsOpenFeatureNotice)
                    {
                        WindowCenter.Instance.Close<MainInterfaceWin>();
                        WindowCenter.Instance.Open<FeatureNoticeWin>();
                        WindowCenter.Instance.Open<FeatureNotice2Win>();
                    }              
                }
            }
@@ -352,21 +389,30 @@
            {
                OpenFuncState openFuncState = new OpenFuncState();
                openFuncState.State = info.FuncStateList[i].State;
                openFuncState.AwardState = info.FuncStateList[i].State;
                openFuncState.AwardState = info.FuncStateList[i].AwardState;
                DicOpenFuncState.Add(FuncID, openFuncState);
            }
            else
            {
                DicOpenFuncState[FuncID].State= info.FuncStateList[i].State;
                DicOpenFuncState[FuncID].AwardState = info.FuncStateList[i].State;
                DicOpenFuncState[FuncID].AwardState = info.FuncStateList[i].AwardState;
            }
        }
        if (UpdateAwarfItem != null)
        {
            UpdateAwarfItem();
        }
        RedPoint_State();
    }
    public void SendGetAward(int OpenFuncId)
    {
        CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward();
        getReward.RewardType = (byte)GotServerRewardType.Def_RewardType_OpenFunc;
        getReward.DataEx = (uint)OpenFuncId;
        getReward.DataExStrLen = 0;
        getReward.DataExStr = string.Empty;
        GameNetSystem.Instance.SendInfo(getReward);
    }
}
System/MainInterfacePanel/FeaturesType3.cs
@@ -27,12 +27,18 @@
        [SerializeField] Button m_IconBtn1;
        [SerializeField] Text m_Number1;
        [SerializeField] ImageEx m_Lock1;
        [SerializeField] UIEffect m_UIEffect1;
        [SerializeField] GameObject m_HasReceived1;
        [SerializeField] ImageEx m_ItemBG2;
        [SerializeField] ImageEx m_Icon2;
        [SerializeField] Button m_IconBtn2;
        [SerializeField] Text m_Number2;
        [SerializeField] ImageEx m_Lock2;
        [SerializeField] UIEffect m_UIEffect2;
        [SerializeField] GameObject m_HasReceived2;
        [SerializeField] RedpointBehaviour m_RedPoint;
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        ItemTipsModel _itemTipsModel;
        ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } }
@@ -100,6 +106,11 @@
                m_Img_Circle.gray = true;
                m_FeaturesTypeIcon.gray = true;
            }
            if (featureNoticeModel.DicRedPoint.ContainsKey(funcId))
            {
                m_RedPoint.redpointId = featureNoticeModel.DicRedPoint[funcId].id;
            }
        }
        private void SetRankAwardItem(int funcID)
@@ -133,13 +144,14 @@
                if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 &&
                featureNoticeModel.DicOpenFuncState[funcID].AwardState == 0)
                {
                    DebugEx.LogError("可以领取");
                    featureNoticeModel.SendGetAward(funcID);
                   // DebugEx.LogError("可以领取");
                }
                else
                {
                    ItemAttrData attrData = new ItemAttrData(List[0].item.id, false, (ulong)List[0].item.count, -1, List[0].isBind);
                    itemTipsModel.SetItemTipsModel(attrData);
                    DebugEx.LogError("弹框");
                   // DebugEx.LogError("弹框");
                }
            });
@@ -172,6 +184,23 @@
                m_Icon1.gray = true;
                m_Lock1.gray = true;
            }
            if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 &&
               featureNoticeModel.DicOpenFuncState[funcID].AwardState == 0)
            {
                m_UIEffect1.Play();
            }
            else
            {
                m_UIEffect1.Stop();
            }
            if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 && featureNoticeModel.DicOpenFuncState[funcID].AwardState == 1)
            {
                m_HasReceived1.SetActive(true);
            }
            else
            {
                m_HasReceived1.SetActive(false);
            }
        }
        private void SetItem2(List<AwardItem> List, int funcID)
        {
@@ -183,13 +212,14 @@
                if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 &&
               featureNoticeModel.DicOpenFuncState[funcID].AwardState == 0)
                {
                    DebugEx.LogError("可以领取");
                    featureNoticeModel.SendGetAward(funcID);
                  // DebugEx.LogError("可以领取");
                }
                else
                {
                    ItemAttrData attrData = new ItemAttrData(List[1].item.id, false, (ulong)List[1].item.count, -1, List[1].isBind);
                    itemTipsModel.SetItemTipsModel(attrData);
                    DebugEx.LogError("弹框");
                    //DebugEx.LogError("弹框");
                }
            });
            if (List[1].item.count > 1)
@@ -221,10 +251,24 @@
                m_Icon2.gray = true;
                m_Lock2.gray = true;
            }
            if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 &&
              featureNoticeModel.DicOpenFuncState[funcID].AwardState == 0)
            {
                m_UIEffect2.Play();
            }
            else
            {
                m_UIEffect2.Stop();
            }
            if (featureNoticeModel.DicOpenFuncState.ContainsKey(funcID) && featureNoticeModel.DicOpenFuncState[funcID].State == 1 && featureNoticeModel.DicOpenFuncState[funcID].AwardState == 1)
            {
                m_HasReceived2.SetActive(true);
            }
            else
            {
                m_HasReceived2.SetActive(false);
            }
        }
    }
}
}