少年修仙传客户端代码仓库
client_Zxw
2018-09-12 ebc2e3cd491aa591eb3b8267555865530084aba9
3488 【前端】【1.0.15】【1.1.0】功能预告优化
2个文件已添加
5个文件已修改
326 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/FunctionForecastConfig.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/FunctionForecastConfig.cs.meta 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeatureNoticeModel.cs 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeatureNoticeModel.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/FeatureNoticeWin.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/MainInterfaceWin.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WindowBase/ModelCenter.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/FunctionForecastConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:            第二世界
//    [  Date ]:           Tuesday, September 11, 2018
//    [  Date ]:           Wednesday, September 12, 2018
//--------------------------------------------------------
using UnityEngine;
@@ -21,7 +21,10 @@
        public string Icon { get ; private set; } 
        public string Content { get ; private set; } 
        public int DisplayLevel { get ; private set ; }
        public int Display { get ; private set ; }
        public int Display { get ; private set ; }
        public int RedPointLV { get ; private set ; }
        public int RedPointPercentage { get ; private set ; }
        public int FrameLevel { get ; private set ; }
        public override string getKey()
        {
@@ -51,7 +54,13 @@
            
                DisplayLevel=IsNumeric(rawContents[9]) ? int.Parse(rawContents[9]):0; 
            
                Display=IsNumeric(rawContents[10]) ? int.Parse(rawContents[10]):0;
                Display=IsNumeric(rawContents[10]) ? int.Parse(rawContents[10]):0;
                RedPointLV=IsNumeric(rawContents[11]) ? int.Parse(rawContents[11]):0;
                RedPointPercentage=IsNumeric(rawContents[12]) ? int.Parse(rawContents[12]):0;
                FrameLevel=IsNumeric(rawContents[13]) ? int.Parse(rawContents[13]):0;
            }
            catch (Exception ex)
            {
Core/GameEngine/Model/Config/FunctionForecastConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: bced258647f0fa940b752dd56e6a27e0
timeCreated: 1536670750
timeCreated: 1536737693
licenseType: Free
MonoImporter:
  serializedVersion: 2
System/MainInterfacePanel/FeatureNoticeModel.cs
New file
@@ -0,0 +1,245 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, September 12, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using TableConfig;
using System.Collections.Generic;
using System;
using Snxxz.UI;
//功能预告红点
public class FeatureNoticeModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public List<FunctionForecastConfig> FunctionList = new List<FunctionForecastConfig>();
    private const int Redpoint_key1 = 38;
    public Redpoint redPointStre1 = new Redpoint(Redpoint_key1);
    private int OpenFuncId = 0;
    private bool RedPointChange = false;
    private bool IsRedPoint = false;
    public override void Init()
    {
        AddList();
    }
    public void OnBeforePlayerDataInitialize()
    {
    }
    public void OnPlayerLoginOk()
    {
        RedDotStatus();
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayersUpLV;
        FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
        treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
        treasureModel.treasureStageUpEvent -= treasureStageUpEvent;
        FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayersUpLV;
        treasureModel.treasureStateChangeEvent += treasureStateChangeEvent;
        treasureModel.treasureStageUpEvent += treasureStageUpEvent;
    }
    public override void UnInit()
    {
    }
    private void treasureStageUpEvent(int obj)
    {
        RedDotStatus();
    }
    private void treasureStateChangeEvent(int obj)
    {
        RedDotStatus();
    }
    private void OnFuncStateChangeEvent(int obj)
    {
        RedDotStatus();
    }
    private void OnPlayersUpLV(PlayerDataRefresh obj)
    {
        if (obj == PlayerDataRefresh.LV)
        {
            RedDotStatus();
        }
    }
    private void AddList()//添加列表信息
    {
        if (FunctionList.Count <= 0)
        {
            var configs = Config.Instance.GetAllKeys<FunctionForecastConfig>();
            foreach (var key in configs)
            {
                var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(key);
                if (functionForecastConfig != null && functionForecastConfig.Display == 1)
                {
                    FunctionList.Add(functionForecastConfig);
                }
            }
        }
    }
    private void RedDotStatus()
    {
        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)
                {
                    IsRedPoint = false;
                    TrailerClassification(FunctionList[i].FuncId);
                }
                return;
            }
        }
    }
    private void TrailerClassification(int funcID)
    {
        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);
            }
            else if (funcoPenConfig.LimitMissionID != 0)//任务
            {
                if (functionForecastConfig.RedPointLV <= 0)
                {
                    return;
                }
                if (PlayerDatas.Instance.baseData.LV - functionForecastConfig.RedPointLV >= funcoPenConfig.LimitLV)
                {
                    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 >= funcoPenConfig.LimitLV)
            {
                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);
        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 = (treasure.exp / treasure.treasureStages[funcStage].exp)*100;
                if (functionForecastConfig.RedPointPercentage > 0)
                {
                    if (exp >= functionForecastConfig.RedPointPercentage)
                    {
                        RedPointChange = true;
                        IsRedPoint = true;
                    }
                    if (IsRedPoint)
                    {
                        redPointStre1.state = RedPointState.Simple;
                    }
                }
                else
                {
                    redPointStre1.state = RedPointState.None;
                }
            }
        }
    }
    public void WhetherToPlayTheBox()
    {
        var inDungeon = IsDungeon();
        var IsOpenMaininterface = WindowCenter.Instance.CheckOpen<MainInterfaceWin>();
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || inDungeon || !IsOpenMaininterface)
        {
            return;
        }
        for (int i = 0; i < FunctionList.Count; i++)
        {
            if (!FuncOpen.Instance.IsFuncOpen(FunctionList[i].FuncId))
            {
                var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(FunctionList[i].FuncId);
                if (functionForecastConfig.FrameLevel <= 0)
                {
                    return;
                }
                string strKey = "FeatureNotice" + functionForecastConfig.FrameLevel;
                int type = LocalSave.GetInt(strKey);
                bool IsOpenMain = WindowCenter.Instance.CheckOpen<MainInterfaceWin>();
                if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.FrameLevel && type == 0)
                {
                    LocalSave.SetInt(strKey, functionForecastConfig.FrameLevel);
                    WindowCenter.Instance.Open<FeatureNoticeWin>();
                }
            }
        }
    }
    private bool IsDungeon()
    {
        var mapId = PlayerDatas.Instance.baseData.MapID;
        var mapConfig = Config.Instance.Get<MapConfig>(mapId);
        return mapConfig != null && mapConfig.MapFBType != 0;
    }
}
System/MainInterfacePanel/FeatureNoticeModel.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e9c203c14c6a0b4419efaefdddbe4d89
timeCreated: 1536732400
licenseType: Free
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/MainInterfacePanel/FeatureNoticeWin.cs
@@ -26,9 +26,8 @@
        [SerializeField] Text m_TextUnopened;//未开启
        [SerializeField] Text m_Textschedule;//进度
        [SerializeField] Button m_ButtonGoto;
        List<FunctionForecastConfig> FunctionList = new List<FunctionForecastConfig>();
        TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        #region Built-in
        private int ClickFuncID = 0;
        protected override void BindController()
@@ -42,7 +41,6 @@
        protected override void OnPreOpen()
        {
            AddList();//添加数组列表
            DefaultSelection();//获取默认选择
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;       
            OnCreateGridLineCell(m_ScrollerController);
@@ -64,6 +62,10 @@
            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
            treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
            treasureModel.treasureStageUpEvent -= treasureStageUpEvent;
            if (featureNoticeModel.redPointStre1.state == RedPointState.Simple)
            {
                featureNoticeModel.redPointStre1.state = RedPointState.None;
            }
        }
        private void treasureStageUpEvent(int obj)
@@ -94,15 +96,15 @@
        void OnCreateGridLineCell(ScrollerController gridCtrl)
        {
            gridCtrl.Refresh();
            for (int i = 0; i < FunctionList.Count; i++)
            for (int i = 0; i < featureNoticeModel.FunctionList.Count; i++)
            {
                if (i == 0)
                {
                    gridCtrl.AddCell(ScrollerDataType.Header, FunctionList[i].FuncId);
                    gridCtrl.AddCell(ScrollerDataType.Header, featureNoticeModel.FunctionList[i].FuncId);
                }
                else
                {
                    gridCtrl.AddCell(ScrollerDataType.Normal, FunctionList[i].FuncId);
                    gridCtrl.AddCell(ScrollerDataType.Normal, featureNoticeModel.FunctionList[i].FuncId);
                }
            }
            gridCtrl.Restart();
@@ -160,22 +162,6 @@
        {
        }
        #endregion
        private void AddList()//添加列表信息
        {
            if (FunctionList.Count <= 0)
            {
                var configs = Config.Instance.GetAllKeys<FunctionForecastConfig>();
                foreach (var key in configs)
                {
                    var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(key);
                    if (functionForecastConfig != null && functionForecastConfig.Display == 1)
                    {
                        FunctionList.Add(functionForecastConfig);
                    }
                }
            }
        }
        private void DefaultSelection()//获取默认选择
        {
            var configs = Config.Instance.GetAllValues<FunctionForecastConfig>();
@@ -190,14 +176,14 @@
            }
            if (ClickFuncID == 0)
            {
                ClickFuncID = FunctionList[0].FuncId;
                ClickFuncID = featureNoticeModel.FunctionList[0].FuncId;
            }
        }
        private int JumpIndex()//Jump选中
        {
            int Index = 0;
            Index = FunctionList.FindIndex((x)=>
            Index = featureNoticeModel.FunctionList.FindIndex((x)=>
            {
                return x.FuncId == ClickFuncID;
            });
@@ -296,7 +282,15 @@
                {
                    if (treasure.stage == funcStage - 1 || funcStage == 0)
                    {
                        m_Textschedule.text = (float)treasure.exp / treasure.treasureStages[funcStage].exp+"%";
                        if (treasure.exp >= treasure.treasureStages[funcStage].exp)
                        {
                            m_Textschedule.text = "100%";
                        }
                        else
                        {
                            m_Textschedule.text = (float)treasure.exp / treasure.treasureStages[funcStage].exp + "%";
                        }
                    }
                    else
                    {
System/MainInterfacePanel/MainInterfaceWin.cs
@@ -136,6 +136,7 @@
        DemonJarModel demonJarModel { get { return ModelCenter.Instance.GetModel<DemonJarModel>(); } }
        DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
        FairyGrabBossModel fairyGrabBossModel { get { return ModelCenter.Instance.GetModel<FairyGrabBossModel>(); } }
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        #region Built-in
        protected override void BindController()
@@ -342,7 +343,7 @@
            m_HighSettingTip.AfterOpen();
            m_ChatTip.OnAfterOpen();
            HandleAchievement();
            featureNoticeModel.WhetherToPlayTheBox();
        }
        protected override void OnPreClose()
@@ -889,6 +890,10 @@
        void Updatefighting(PlayerDataRefresh _tCDBPlayerRefresh)//数据的刷新
        {
            ArticleExperience();//关于经验条
            if (_tCDBPlayerRefresh == PlayerDataRefresh.LV)
            {
                featureNoticeModel.WhetherToPlayTheBox();
            }
        }
        void OnCollectBtnClick()
System/WindowBase/ModelCenter.cs
@@ -193,6 +193,7 @@
            RegisterModel<FairyGrabBossModel>();
            RegisterModel<GodBeastModel>();
            RegisterModel<PrayForDurgModel>();
            RegisterModel<FeatureNoticeModel>();
            inited = true;
        }