//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, November 24, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using TableConfig;
|
using System.Collections.Generic;
|
using System;
|
using Snxxz.UI;
|
|
//用于记录主界面的一些信息
|
|
public class PlayerMainDate : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
CapacityDelayModel m_CapacityDelayModel;
|
CapacityDelayModel capacityDelayModel { get { return m_CapacityDelayModel ?? (m_CapacityDelayModel = ModelCenter.Instance.GetModel<CapacityDelayModel>()); } }
|
PlayerDeadModel _deadModel;
|
PlayerDeadModel DeadModel
|
{ get { return _deadModel ?? (_deadModel = ModelCenter.Instance.GetModel<PlayerDeadModel>()); } }
|
PlayerPackModel m_PlayerPackModel;
|
PlayerPackModel playerPack
|
{
|
get { return m_PlayerPackModel ?? (m_PlayerPackModel = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
}
|
//用于记录XP技能的信息
|
public delegate void OnXpSkill();
|
public static event OnXpSkill Event_XpSkill;
|
public int SkillID = 0;
|
//--------------------------------------------------------------
|
public Dictionary<int, int> GetCurrencyItemID = new Dictionary<int, int>();
|
|
//关于自动寻路
|
public bool MoveBool = false;
|
|
//-------用于每分钟经验的获取
|
public delegate void OnExperience(int _source, int _ExpPoint, int _Exp);//(1.单位经验亿点,2.经验单位点)
|
public static event OnExperience Event_Experience;
|
|
//--------------------用于战斗力滚动
|
private int prowNum = 0;
|
public int ProwNumAdd = 0;
|
private bool prowBool = true;
|
|
//----------用于显示电量;
|
public float ElectricQuantity = 1;
|
public static Action ElectricQuantityEvent;
|
//---------用于网络信号;
|
public int NetworkState = 1;
|
public int WifiSignal = 3;//wifi信号强度
|
public static Action NetworkStateEvent;
|
|
//--------娲皇遗迹;中的层数记录一下下
|
public int _layerNumber = 1;//服务端的层数
|
public int LayerNumber
|
{
|
get
|
{
|
if (_layerNumber < 0)
|
{
|
_layerNumber = 0;
|
}
|
return _layerNumber;
|
}
|
set
|
{
|
_layerNumber = value;
|
}
|
}
|
public int LayerNumberNow = 0;//现在的选择层数
|
//-------------用来控住主界面的Tip的执行调用
|
public bool IsTipBool = true;
|
|
|
//----------记录任务面板玩家是否执行点击,进行自动任务
|
public bool IsSelfMotionTask = false;
|
|
|
//-------------记录仙盟任务放弃任务否不再提示
|
public bool IsBoolFairyAuTaskAbandon = false;
|
//------------记录仙盟任务花费仙玉是否不再提示
|
public bool IsBoolFairyAuTask = false;
|
|
//------------记录赏金任务花费仙玉是否不再提示
|
public bool IsBoolCoinTask = false;
|
//-----记录当前神秘任务的ID
|
public int MysteriousTaskID = 0;
|
// 用来记录区域状态 (PK模式)
|
|
public int AreaState = 0;//默认和平状态
|
|
//-------用于记录在Boss区域任务条的显隐状态
|
public bool IsBossAreaTask = false;
|
//----龙雀环技能飘动要的切换接口
|
public void FunctionButton()//直接开始功能按钮组
|
{
|
WindowCenter.Instance.Get<MainInterfaceWin>().IsShowButtonGroup();
|
}
|
//-----是否在自动强化中
|
public bool StrengthegingBool = false;//是否再自动强化中
|
public int StrengthegingAddFight = 0;//存取需要添加的战斗力值
|
// --用于任务仙玉不足购买飞鞋
|
public bool IsFlyShoseBool = false;
|
public int FlyShoseTaskID = 0;
|
//--------获取玩家死亡状态
|
public bool IsDead = false;
|
public override void Init()
|
{
|
IsTipBool = true;
|
ElectricQuantity = SDKUtility.Instance.BatteryLevel * 0.01f;
|
if (GetCurrencyItemID.Count <= 0)
|
{
|
string str = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MoneyDisplayModel").Numerical1;
|
GetCurrencyItemID = ConfigParse.GetDic<int, int>(str);
|
|
}
|
OneKeyList.Clear();
|
var funconfig = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("OneKeyBtnMap");
|
int[] Listmap = ConfigParse.GetMultipleStr<int>(funconfig.Numerical1);
|
for (int i = 0; i < Listmap.Length; i++)
|
{
|
OneKeyList.Add(Listmap[i]);
|
}
|
NetworkState = (int)SDKUtility.Instance.NetworkType;
|
}
|
//----------关于某些副本可以进行地图挂机
|
public List<int> OneKeyList = new List<int>();
|
|
//----------使用娲皇卷轴后的Buff表现
|
public static event Action EmperorBuffEvent;
|
public bool IsEmperor = false;
|
private void UseItemSuccessAct(int Index, int ItemID)
|
{
|
if (ItemID == 221)
|
{
|
if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
|
{
|
WindowCenter.Instance.CloseAll(WindowCenter.CloseAllIgnoreType.SystemAndCustom);
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
if (PlayerDatas.Instance.hero != null)
|
{
|
SFXController _sfx = SFXPlayUtility.Instance.PlayBattleEffect(5174, PlayerDatas.Instance.hero);
|
_sfx.m_OnFinished += OnSFXDisable;
|
}
|
|
}
|
}
|
private void OnSFXDisable(SFXController _controller)
|
{
|
_controller.m_OnFinished -= OnSFXDisable;
|
if (EmperorBuffEvent != null)
|
{
|
IsEmperor = true;
|
EmperorBuffEvent();
|
}
|
}
|
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
MapTransferUtility.s_OnHeroStartMoveToNPC -= OnStartPathFind;
|
PlayerDatas.Instance.hero.OnPathFindStop -= OnFinishedPathFind;
|
SDKUtility.Instance.OnBatteryLevelChanged -= OnBatteryChanged;//电量
|
SDKUtility.Instance.OnNetworkStatusChanged -= OnNetStatusChanged;//无网络
|
StrengtheningSripts.IsFightUp -= IsFightUp;//停止自动强化
|
DeadModel.playerDieEvent -= playerDieEvent;
|
playerPack.UseItemSuccessAct -= UseItemSuccessAct;
|
|
MapTransferUtility.s_OnHeroStartMoveToNPC += OnStartPathFind;
|
PlayerDatas.Instance.hero.OnPathFindStop += OnFinishedPathFind;
|
SDKUtility.Instance.OnBatteryLevelChanged += OnBatteryChanged;//电量
|
SDKUtility.Instance.OnNetworkStatusChanged += OnNetStatusChanged;//无网络
|
StrengtheningSripts.IsFightUp += IsFightUp;//停止自动强化
|
DeadModel.playerDieEvent += playerDieEvent;//获取玩家死亡状态
|
playerPack.UseItemSuccessAct += UseItemSuccessAct;
|
}
|
|
|
|
private void playerDieEvent()
|
{
|
IsDead = true;
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
FlyShoseTaskID = 0;
|
IsFlyShoseBool = false;
|
StrengthegingAddFight = 0;
|
StrengthegingBool = false;
|
IsTipBool = true;
|
prowNum = 0;
|
ProwNumAdd = 0;
|
prowBool = true;
|
SkillID = 0;
|
MoveBool = false;
|
IsSelfMotionTask = false;
|
IsBoolFairyAuTask = false;
|
IsBoolFairyAuTaskAbandon = false;
|
IsBoolCoinTask = false;
|
IsBossAreaTask = false;
|
IsDead = false;
|
IsEmperor = false;
|
if (PlayerDatas.Instance.hero != null)
|
{
|
MapTransferUtility.s_OnHeroStartMoveToNPC -= OnStartPathFind;
|
PlayerDatas.Instance.hero.OnPathFindStop -= OnFinishedPathFind;
|
}
|
|
}
|
|
private void OnNetStatusChanged(NetworkReachability arg0)
|
{
|
NetworkState = (int)arg0;
|
if (NetworkStateEvent != null)
|
{
|
NetworkStateEvent();
|
}
|
}
|
|
private void onWifiSignalChanged(int arg0)
|
{
|
WifiSignal = arg0;
|
NetworkState = arg0;
|
if (NetworkStateEvent != null)
|
{
|
NetworkStateEvent();
|
}
|
}
|
|
private void onPhoneSignalChanged(int arg0)
|
{
|
NetworkState = arg0;
|
if (NetworkStateEvent != null)
|
{
|
NetworkStateEvent();
|
}
|
}
|
|
private void OnBatteryChanged(int arg0)
|
{
|
ElectricQuantity = SDKUtility.Instance.BatteryLevel * 0.01f;
|
if (ElectricQuantityEvent != null)
|
{
|
ElectricQuantityEvent();
|
}
|
}
|
|
|
private void OnStartPathFind()
|
{
|
|
MoveBool = true;
|
}
|
|
private void OnFinishedPathFind()
|
{
|
|
MoveBool = false;
|
}
|
public void XpSkill(int _SkillID, int _RemainTime)
|
{
|
SkillID = _SkillID;
|
if (Event_XpSkill != null)
|
Event_XpSkill();
|
}
|
|
public void PowerAdd(int power)
|
{
|
if (prowBool)
|
{
|
prowNum = power;
|
prowBool = false;
|
}
|
else
|
{
|
if (power > prowNum)
|
{
|
ProwNumAdd = power - prowNum;
|
if (StrengthegingBool || StrengthegingAddFight != 0)
|
{
|
StrengthegingAddFight += ProwNumAdd;
|
}
|
prowNum = power;
|
if (!StrengthegingBool && StrengthegingAddFight == 0)
|
{
|
if (WindowCenter.Instance.CheckOpen<PowerAddWin>())
|
{
|
WindowCenter.Instance.CloseImmediately<PowerAddWin>();
|
}
|
WindowCenter.Instance.Open<PowerAddWin>();
|
}
|
|
}
|
else
|
{
|
prowNum = power;
|
}
|
}
|
}
|
|
private void IsFightUp()//存储自动强化中间的值
|
{
|
if (StrengthegingAddFight > 0)
|
{
|
SnxxzGame.Instance.StartCoroutine(LoadingIE());
|
}
|
|
}
|
|
IEnumerator LoadingIE()
|
{
|
yield return new WaitForSeconds(0.5f);
|
ProwNumAdd = StrengthegingAddFight;
|
StrengthegingAddFight = 0;
|
if (WindowCenter.Instance.CheckOpen<PowerAddWin>())
|
{
|
WindowCenter.Instance.CloseImmediately<PowerAddWin>();
|
}
|
WindowCenter.Instance.Open<PowerAddWin>();
|
}
|
|
public void KissMonsterExperience(int _source, int _ExpPoint, int _Exp)//(1.单位经验亿点,2.经验单位点)
|
{
|
if (Event_Experience != null)
|
{
|
Event_Experience(_source, _ExpPoint, _Exp);
|
}
|
}
|
public bool IsRedPointShowPanel()//当主界面有带有“领”字的红点上层面板默认展开
|
{
|
bool IsBool = false;
|
var State1 = RedpointCenter.Instance.GetRedpointState(201);//福利
|
var State2 = RedpointCenter.Instance.GetRedpointState(210);
|
if (State1 == RedPointState.Simple || State1 == RedPointState.GetReward || State2 == RedPointState.Simple)
|
{
|
IsBool = true;
|
}
|
return IsBool;
|
}
|
}
|
|
|
|
|
|