//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, June 29, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
|
using vnxbqy.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()
|
{
|
TaskModel.TaskCoinTaskEvent -= TaskCoinTaskEvent;
|
TaskModel.TaskCoinTaskEvent += TaskCoinTaskEvent;
|
|
TaskModel.FairyTaskEvent -= FairyTaskEvent;
|
TaskModel.FairyTaskEvent += FairyTaskEvent;
|
StageLoad.Instance.onStageLoadFinish -= onStageLoadFinish;
|
StageLoad.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 = MapConfig.Get(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 (CrossServerUtility.IsCrossServer())//在跨服竞技场不打开
|
{
|
yield break;
|
}
|
if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>())
|
{
|
yield break;
|
}
|
if (WindowCenter.Instance.IsOpen<TaskWin>())
|
{
|
yield break;
|
}
|
int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
|
if (GetCylinderNumber == 10)
|
{
|
IsPopup = true;
|
}
|
if (WindowCenter.Instance.IsOpen<MainInterfaceWin>())
|
{
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.BountyInterface);
|
}
|
}
|
|
private IEnumerator FairyAuTaskPanel()
|
{
|
yield return WaitingForSecondConst.WaitMS1500;
|
if (CrossServerUtility.IsCrossServer())//在跨服竞技场不打开
|
{
|
yield break;
|
}
|
if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>())
|
{
|
yield break;
|
}
|
if (WindowCenter.Instance.IsOpen<FairyAuTaskWin>())
|
{
|
yield break;
|
}
|
int AllFairyAuNumber = TaskAllocation.Instance.FairyAuAllNumber();//获取仙盟总环数
|
if (AllFairyAuNumber < 70)
|
{
|
IsFairy = true;
|
}
|
if (WindowCenter.Instance.IsOpen<MainInterfaceWin>())
|
{
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.UnionTask);
|
}
|
}
|
}
|
|
|
|
|