少年修仙传客户端代码仓库
client_linchunjie
2018-08-17 ac9d8041bba04644b56d9ec587c46369c56cb7f1
System/MainInterfacePanel/CoinTaskTipModel.cs
@@ -1,138 +1,160 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, June 29, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using TableConfig;
using Snxxz.UI;
using System;
public class CoinTaskTipModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public bool IsPopup = false;//赏金
    public bool IsinDungeon = false;
    public bool IsFairy = false;//仙盟
    public bool IsinDungeon1 = false;
    public override void Init()
    {
    }
    public override void UnInit()
    {
    }
    public void OnBeforePlayerDataInitialize()
    {
        IsPopup = false;
        IsFairy = false;
        IsinDungeon = false;
        IsinDungeon1 = false;
    }
    public void OnPlayerLoginOk()
    {
        PlayerTaskDatas.TaskCoinTaskEvent -= TaskCoinTaskEvent;
        PlayerTaskDatas.TaskCoinTaskEvent += TaskCoinTaskEvent;
        PlayerTaskDatas.FairyTaskEvent -= FairyTaskEvent;
        PlayerTaskDatas.FairyTaskEvent += FairyTaskEvent;
        StageManager.Instance.onStageLoadFinish -= onStageLoadFinish;
        StageManager.Instance.onStageLoadFinish += onStageLoadFinish;
    }
    private void onStageLoadFinish()
    {
        if (IsinDungeon)
        {
            SnxxzGame.Instance.StartCoroutine(PopupPanel());
            IsinDungeon = false;
        }
        if (IsinDungeon1)
        {
            SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            IsinDungeon1 = false;
        }
    }
    private bool IsDungeon()//判断是否在副本中
    {
        var mapId = PlayerDatas.Instance.baseData.MapID;
        var mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(mapId);
        return mapConfig != null && mapConfig.MapFBType != 0;
    }
    private void TaskCoinTaskEvent()
    {
        int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
        if (GetCylinderNumber == 10)
        {
            var inDungeon = IsDungeon();
            if (inDungeon)
            {
                IsinDungeon = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(PopupPanel());
            }
        }
    }
    private void FairyTaskEvent()
    {
        int GetFairyAuNumber = TaskAllocation.Instance.FairyAuNumber();//获取仙盟单轮完成环数
        int AllFairyAuNumber = TaskAllocation.Instance.FairyAuAllNumber();//获取仙盟总环数
        if (GetFairyAuNumber == 10 && AllFairyAuNumber<70)
        {
            var inDungeon = IsDungeon();
            if (inDungeon)
            {
                IsinDungeon1 = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            }
        }
    }
    private IEnumerator PopupPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.CheckOpen<TreasureLevelUpWin>())
        {
            yield break;
        }
        IsPopup = true;
        if (WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.BountyInterface);
        }
    }
    private IEnumerator FairyAuTaskPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.CheckOpen<TreasureLevelUpWin>())
        {
            yield break;
        }
        IsFairy = true;
        if (WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.UnionTask);
        }
    }
}
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, June 29, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using TableConfig;
using Snxxz.UI;
using System;
public class CoinTaskTipModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public bool IsPopup = false;//赏金
    public bool IsinDungeon = false;
    public bool IsFairy = false;//仙盟
    public bool IsinDungeon1 = false;
    public override void Init()
    {
    }
    public override void UnInit()
    {
    }
    public void OnBeforePlayerDataInitialize()
    {
        IsPopup = false;
        IsFairy = false;
        IsinDungeon = false;
        IsinDungeon1 = false;
    }
    public void OnPlayerLoginOk()
    {
        PlayerTaskDatas.TaskCoinTaskEvent -= TaskCoinTaskEvent;
        PlayerTaskDatas.TaskCoinTaskEvent += TaskCoinTaskEvent;
        PlayerTaskDatas.FairyTaskEvent -= FairyTaskEvent;
        PlayerTaskDatas.FairyTaskEvent += FairyTaskEvent;
        StageManager.Instance.onStageLoadFinish -= onStageLoadFinish;
        StageManager.Instance.onStageLoadFinish += onStageLoadFinish;
    }
    private void onStageLoadFinish()
    {
        if (IsinDungeon)
        {
            SnxxzGame.Instance.StartCoroutine(PopupPanel());
            IsinDungeon = false;
        }
        if (IsinDungeon1)
        {
            SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            IsinDungeon1 = false;
        }
    }
    private bool IsDungeon()//判断是否在副本中
    {
        var mapId = PlayerDatas.Instance.baseData.MapID;
        var mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(mapId);
        return mapConfig != null && mapConfig.MapFBType != 0;
    }
    private void TaskCoinTaskEvent()
    {
        int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
        var inDungeon = IsDungeon();
        if (GetCylinderNumber == 10)
        {
            if (inDungeon)
            {
                IsinDungeon = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(PopupPanel());
            }
        }
        if (GetCylinderNumber == 20)
        {
            if (!inDungeon)
            {
                SnxxzGame.Instance.StartCoroutine(PopupPanel());
            }
        }
    }
    private void FairyTaskEvent()
    {
        int GetFairyAuNumber = TaskAllocation.Instance.FairyAuNumber();//获取仙盟单轮完成环数
        if (GetFairyAuNumber == 10)
        {
            var inDungeon = IsDungeon();
            if (inDungeon)
            {
                IsinDungeon1 = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            }
        }
    }
    private IEnumerator PopupPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.CheckOpen<TreasureLevelUpWin>())
        {
            yield break;
        }
        if (WindowCenter.Instance.CheckOpen<TaskWin>())
        {
            yield break;
        }
        int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
        if (GetCylinderNumber == 10)
        {
            IsPopup = true;
        }
        if (WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.BountyInterface);
        }
    }
    private IEnumerator FairyAuTaskPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.CheckOpen<TreasureLevelUpWin>())
        {
            yield break;
        }
        if (WindowCenter.Instance.CheckOpen<FairyAuTaskWin>())
        {
            yield break;
        }
        int AllFairyAuNumber = TaskAllocation.Instance.FairyAuAllNumber();//获取仙盟总环数
        if (AllFairyAuNumber < 70)
        {
            IsFairy = true;
        }
        if (WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.UnionTask);
        }
    }
}