少年修仙传客户端代码仓库
Client_PangDeRong
2018-09-18 8cea417746487967704e5abc758dfadfe3dd25dc
3586 商城出售坐骑、灵宠推送
4个文件已修改
2个文件已添加
411 ■■■■■ 已修改文件
System/MainInterfacePanel/TipPanel.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Store/PetAndMountPushWin.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Store/PetAndMountPushWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Store/StoreModel.cs 299 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Store/StoreWin.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WindowBase/WindowCenter.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/TipPanel.cs
@@ -21,6 +21,7 @@
        LoginAdModel loginAdModel { get { return ModelCenter.Instance.GetModel<LoginAdModel>(); } }
        FirstTimeRechargeModel firstTimeRechargeModel { get { return ModelCenter.Instance.GetModel<FirstTimeRechargeModel>(); } }
        StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
        public TipPanel()
        {
@@ -90,6 +91,10 @@
            {
                firstTimeRechargeModel.OpenFirstChargeTrialWin();
            }
            else if(!WindowCenter.Instance.CheckOpen<PetAndMountPushWin>()) //灵宠坐骑推送
            {
                storeModel.SetPushPetAndMountWinState();
            }
            if (mainModel.IsTipBool)
            {
System/Store/PetAndMountPushWin.cs
New file
@@ -0,0 +1,91 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using TableConfig;
namespace Snxxz.UI
{
    public class PetAndMountPushWin : Window
    {
        [SerializeField] Text titleText;
        [SerializeField] RawImage rawImag;
        [SerializeField] Button closeBtn;
        [SerializeField] RichText m_Goto;
        StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
        protected override void BindController()
        {
            closeBtn.AddListener(ClickCloseBtn);
        }
        protected override void AddListeners()
        {
            m_Goto.OnClick += ClickGoTo;
        }
        protected override void OnPreOpen()
        {
            storeModel.pushRefreshEvent += UpdatePushInfo;
            UpdatePushInfo();
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
            storeModel.pushRefreshEvent -= UpdatePushInfo;
        }
        protected override void OnAfterClose()
        {
        }
        private void UpdatePushInfo()
        {
            if(storeModel.currentPushId == 0)
            {
                CloseImmediately();
            }
            else
            {
                StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(storeModel.currentPushId);
                ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeConfig.ItemID);
                rawImag.gameObject.SetActive(true);
                if(itemConfig != null)
                {
                    switch (itemConfig.Type)
                    {
                        case 26:
                            titleText.text = "新灵宠上架";
                            PetInfoConfig petInfo = tipsModel.unlockPetDict[storeConfig.ItemID];
                            var config = Config.Instance.Get<NPCConfig>(petInfo.ID);
                            UI3DModelExhibition.Instance.BeginShowNPC(petInfo.ID, config.UIModeLOffset, config.UIModelRotation,rawImag);
                            break;
                        case 41:
                            titleText.text = "新坐骑上架";
                            HorseConfig horseConfig = tipsModel.unlockMountDict[storeConfig.ItemID];
                            UI3DModelExhibition.Instance.BeginShowHourse(horseConfig.Model,rawImag);
                            break;
                    }
                }
            }
        }
        private void ClickGoTo()
        {
            CloseImmediately();
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc3);
        }
        private void ClickCloseBtn()
        {
            storeModel.RemovePetAndMountPush(storeModel.currentPushId);
        }
    }
}
System/Store/PetAndMountPushWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a7995973b99ad284aa28eb7786f9116c
timeCreated: 1537183206
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Store/StoreModel.cs
@@ -5,6 +5,7 @@
using TableConfig;
using UnityEngine;
using LitJson;
using System.Collections;
public class BuyShopItemLimit
{
@@ -50,18 +51,24 @@
        showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
        FuncConfigConfig mallPush = Config.Instance.Get<FuncConfigConfig>("MallPush");
        StoreRedIdlist = ConfigParse.GetMultipleStr<int>(mallPush.Numerical2);
        MainInterfaceWin.IsCopyOfThePanel += OnMoveTopPart;
    }
    public void OnBeforePlayerDataInitialize()
    {
        IsMustBuyDay = false;
        isLogin = true;
        StageManager.Instance.onStageLoadFinish -= OnStageLoadFinish;
        FuncOpen.Instance.OnFuncStateChangeEvent -= FuncStateChange;
        WindowCenter.Instance.windowAfterCloseEvent -= windowAfterOpen;
        WindowCenter.Instance.windowAfterCloseEvent -= windowAfterClose;
        PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= RefreshServerHour;
        PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= RefreshFamilyLv;
        RefreshTCBPlayerDataEvent -= RefreshPlayerLv;
        TimeMgr.Instance.OnHourEvent -= RefreshServerHour;
        NewBieCenter.Instance.guideBeginEvent -= GuidBegin;
        shopItemlimitDict.Clear();
        petAndMountPushlist.Clear();
        tagTowerModel = null;
        storeFuncType = StoreFunc.WeekStore;
        tcbRefreshDict.Clear();
@@ -77,20 +84,25 @@
    public void OnPlayerLoginOk()
    {
        PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += RefreshFamilyLv;
        PlayerDatas.Instance.fairyData.OnRefreshFairyMine += RefreshServerHour;
        FuncOpen.Instance.OnFuncStateChangeEvent += FuncStateChange;
        RefreshTCBPlayerDataEvent += RefreshPlayerLv;
        TimeMgr.Instance.OnHourEvent += RefreshServerHour;
        StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
        WindowCenter.Instance.windowAfterOpenEvent += windowAfterOpen;
        WindowCenter.Instance.windowAfterCloseEvent += windowAfterClose;
        NewBieCenter.Instance.guideBeginEvent += GuidBegin;
        SetIsMustBuyDay();
        shoplist = null;
        CheckWeekStoreIsShopBuy(out shoplist);
        ControllerRedPoint();
        SetShopRedpoint();
        CheckShopRedpoint();
        UpdateFreeShopRedpoint();
        UpdateCanBuyRedpoint();
        SetJobReplaceIDDict();
        UpdateMustBuyRedpoint();
        UpdatePetAndMountPutAwayRedpoint();
        isLogin = false;
    }
@@ -137,21 +149,24 @@
        switch(type)
        {
            case PlayerDataRefresh.LV:
                CheckShopRedpoint();
                UpdateFreeShopRedpoint();
                UpdateCanBuyRedpoint();
                UpdateMustBuyRedpoint();
                UpdatePetAndMountPutAwayRedpoint();
                break;
            case PlayerDataRefresh.VIPLv:
            case PlayerDataRefresh.Gold:
            case PlayerDataRefresh.GoldPaper:
            case PlayerDataRefresh.FBHelpPoint:
                CheckShopRedpoint();
                UpdateFreeShopRedpoint();
                UpdateCanBuyRedpoint();
                break;
        }
    }
    public override void UnInit()
    {
        MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart;
    }
 
    ItemTipsModel _itemTipsModel;
@@ -297,8 +312,10 @@
    
        if(!isLogin)
        {
            CheckShopRedpoint();
            UpdateFreeShopRedpoint();
            UpdateCanBuyRedpoint();
            UpdateMustBuyRedpoint();
            UpdatePetAndMountPutAwayRedpoint();
        }
        if (RefreshBuyShopLimitEvent != null)
            RefreshBuyShopLimitEvent();
@@ -684,8 +701,10 @@
            }
        }
        SetShopRedpoint();
        CheckShopRedpoint();
        UpdateFreeShopRedpoint();
        UpdateCanBuyRedpoint();
        UpdateMustBuyRedpoint();
        UpdatePetAndMountPutAwayRedpoint();
    }
    public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
@@ -835,18 +854,39 @@
        }
    }
    public void CheckShopRedpoint()
    public void UpdateFreeShopRedpoint()
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        foreach(var key in shopRedDict.Keys)
        foreach (var key in shopRedDict.Keys)
        {
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
            if(!mustIdlist.Contains(storeConfig.ItemID))
            if (storeConfig.MoneyNumber == 0)
            {
                if (storeConfig.MoneyNumber == 0)
                if (CheckShopIsCanBuy(storeConfig))
                {
                    if (CheckShopIsCanBuy(storeConfig))
                    shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                }
                else
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                }
            }
        }
    }
    public void UpdateCanBuyRedpoint()
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        foreach (var key in shopRedDict.Keys)
        {
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
            if (StoreRedIdlist.Contains(storeConfig.ID))
            {
                if (CheckShopIsCanBuy(storeConfig))
                {
                    if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                    }
@@ -857,17 +897,9 @@
                }
                else
                {
                    if (CheckScoreStoreIsCanBuy(storeConfig))
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                    }
                    else
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.None;
                    }
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                }
            }
        }
    }
@@ -976,6 +1008,229 @@
        return false;
    }
    /// <summary>
    /// 新灵宠坐骑上架红点
    /// </summary>
    public void UpdatePetAndMountPutAwayRedpoint()
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        List<StoreConfig> storelist = StoreConfig.GetAllShoplist();
        for(int i = 0; i < storelist.Count; i++)
        {
            if (storelist[i].ShopType != (int)StoreFunc.GrowStrongerStore) continue;
            ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storelist[i].ItemID);
            string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"ShopId",storelist[i].ID);
            switch(itemConfig.Type)
            {
                case 26:
                case 41:
                    if(CheckShopIsCanBuy(storelist[i]))
                    {
                        if (!PlayerPrefs.HasKey(key))
                        {
                            shopRedDict[storelist[i].ID].state = RedPointState.Simple;
                            LocalSave.SetBool(key,true);
                            SetPetAndMountPushData(storelist[i].ID);
                        }
                        else
                        {
                            if(LocalSave.GetBool(key))
                            {
                                shopRedDict[storelist[i].ID].state = RedPointState.Simple;
                            }
                            else
                            {
                                shopRedDict[storelist[i].ID].state = RedPointState.None;
                            }
                        }
                    }
                    else
                    {
                        PlayerPrefs.DeleteKey(key);
                        shopRedDict[storelist[i].ID].state = RedPointState.None;
                    }
                    break;
            }
        }
    }
    public void ClearPetAndMountRedpoint(StoreConfig storeConfig)
    {
        ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeConfig.ItemID);
        switch (itemConfig.Type)
        {
            case 26:
            case 41:
                string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeConfig.ID);
                if (shopRedDict[storeConfig.ID].state == RedPointState.Simple)
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                    LocalSave.SetBool(key,false);
                }
                break;
        }
    }
    #endregion
    #region 坐骑灵宠推送
    List<int> petAndMountPushlist = new List<int>();
    public int currentPushId { get; private set; }
    public event Action pushRefreshEvent;
    private void SetPetAndMountPushData(int shopId)
    {
        if (!petAndMountPushlist.Contains(shopId))
        {
            petAndMountPushlist.Add(shopId);
        }
        if (currentPushId == 0 || (currentPushId != 0 && currentPushId != shopId))
        {
            currentPushId = shopId;
            if (pushRefreshEvent != null)
            {
                pushRefreshEvent();
            }
        }
        if(!isLogin)
        {
            SetPushPetAndMountWinState();
        }
    }
    private int cacheMapId = 0;
    private void OnStageLoadFinish()
    {
        if (PlayerDatas.Instance.baseData.MapID == cacheMapId)
        {
            return;
        }
        MapConfig curMapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
        if (curMapConfig == null || curMapConfig.MapFBType != 0)
        {
            SetPushPetAndMountWinState(true,true);
        }
    }
    private void GuidBegin()
    {
        SetPushPetAndMountWinState(true,true);
    }
    private void OnMoveTopPart(bool isMove)
    {
        SetPushPetAndMountWinState(!isMove);
    }
    private void windowAfterOpen(Window win)
    {
        if (win is FirstTimeRechargeWin)
        {
            SetPushPetAndMountWinState(true,true);
        }
    }
    private void windowAfterClose(Window win)
    {
        if(win is MainInterfaceWin)
        {
            SetPushPetAndMountWinState(true);
        }
        else if(win is RoleParticularsWin
            || win is FirstTimeRechargeWin)
        {
            SetPushPetAndMountWinState();
        }
    }
    public void SetPushPetAndMountWinState(bool isMustClose = false, bool isClearData = false)
    {
        if(isClearData)
        {
            ClearPushData();
            WindowCenter.Instance.CloseImmediately<PetAndMountPushWin>();
            return;
        }
        if(CheckIsShowPush(isMustClose))
        {
            if (!WindowCenter.Instance.CheckOpen<PetAndMountPushWin>())
            {
                WindowCenter.Instance.Open<PetAndMountPushWin>();
            }
        }
        else
        {
            WindowCenter.Instance.CloseImmediately<PetAndMountPushWin>();
        }
    }
    public bool CheckIsShowPush(bool isMustClose = false)
    {
        bool isShow = false;
        if (isMustClose)
        {
            isShow = false;
        }
        else
        {
            MapConfig curMapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
            if ((curMapConfig == null || curMapConfig.MapFBType != 0)
                || !WindowCenter.Instance.CheckOpen<MainInterfaceWin>()
                || NewBieCenter.Instance.inGuiding
                || WindowCenter.Instance.CheckOpen<FirstTimeRechargeWin>()
                || currentPushId == 0)
            {
                isShow = false;
            }
            else
            {
                isShow = true;
            }
        }
        return isShow;
    }
    public void ClearPushData()
    {
        currentPushId = 0;
        petAndMountPushlist.Clear();
    }
    public void RemovePetAndMountPush(int shopId)
    {
        if(petAndMountPushlist.Contains(shopId))
        {
            petAndMountPushlist.Remove(shopId);
            currentPushId = GetPrePetAndMountPushId();
            if(pushRefreshEvent != null)
            {
                pushRefreshEvent();
            }
        }
        else
        {
            ClearPushData();
        }
    }
    private int GetPrePetAndMountPushId()
    {
        currentPushId = 0;
        for(int i = petAndMountPushlist.Count - 1; i > -1; i--)
        {
            currentPushId = petAndMountPushlist[i];
            break;
        }
        return currentPushId;
    }
    #endregion
}
System/Store/StoreWin.cs
@@ -101,6 +101,7 @@
            m_storeModel.RefreshBuyShopLimitEvent += OnCreate;
            RefreshCoins();
            RefreshResetTime();
            m_storeModel.SetPushPetAndMountWinState(true,true);
        }
        protected override void OnActived()
@@ -394,6 +395,7 @@
                            shopItemCell.LoadGuidEffectCtrl(shopInfo.ID, shopId);
                        }
                        m_storeModel.ClearMustBuyRedpoint(shopInfo);
                        m_storeModel.ClearPetAndMountRedpoint(shopInfo);
                        m_storeModel.OnClickShopCell(shopInfo);
                    });
                }
System/WindowBase/WindowCenter.cs
@@ -14,7 +14,7 @@
        List<string> closeAllIgnoreWindows = new List<string>() {
            "MessageWin", "NewBieWin", "NewItemGetWin", "AttributePromoteShowWin" ,"DungeonBeginCoolDownWin","DungeonFightWin","StatusTipWin"
            ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin","BattleHintWin",
            "TreasureDungeonMissionHintWin","FairyGrabBossHintWin","DungeonFairyFeastHintWin",
            "TreasureDungeonMissionHintWin","FairyGrabBossHintWin","DungeonFairyFeastHintWin","PetAndMountPushWin",
        };
        UIRoot m_UIRoot;