using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
using System;
|
|
//用于记录主界面的一些信息
|
|
public class PlayerMainDate : GameSystemManager<PlayerMainDate>
|
{
|
public event Action AddPowerEvent;
|
|
|
//-------用于每分钟经验的获取
|
public delegate void OnExperience(int _source, int _ExpPoint, int _Exp);//(1.单位经验亿点,2.经验单位点)
|
public static event OnExperience Event_Experience;
|
|
//--------------------用于战斗力滚动
|
|
public long prowNum = 0;
|
public long prowNumChange = 0;
|
public bool isAdd = true;//为true增加 为false减少
|
private bool prowBool = true;
|
|
public event Func<bool> customDisplayPower;
|
|
public override void Init()
|
{
|
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
|
}
|
|
|
public override void Release()
|
{
|
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
|
}
|
|
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
prowNum = 0;
|
prowNumChange = 0;
|
prowBool = true;
|
|
}
|
|
|
public void PowerAdd(ulong power)
|
{
|
if (prowBool)
|
{
|
prowNum = (long)power;
|
prowBool = false;
|
}
|
else
|
{
|
if ((long)power > prowNum)
|
{
|
prowNumChange = (long)power - prowNum;
|
prowNum = (long)power;
|
isAdd = true;
|
if (customDisplayPower != null && customDisplayPower())
|
{
|
return;
|
}
|
if (UIManager.Instance.IsOpened<PowerAddWin>())
|
{
|
AddPowerEvent?.Invoke();
|
return;
|
}
|
UIManager.Instance.OpenWindow<PowerAddWin>();
|
}
|
else if ((long)power < prowNum)
|
{
|
prowNumChange = prowNum - (long)power;
|
prowNum = (long)power;
|
isAdd = false;
|
if (customDisplayPower != null && customDisplayPower())
|
{
|
return;
|
}
|
if (UIManager.Instance.IsOpened<PowerAddWin>())
|
{
|
AddPowerEvent?.Invoke();
|
return;
|
}
|
UIManager.Instance.OpenWindow<PowerAddWin>();
|
}
|
else
|
{
|
prowNum = (long)power;
|
}
|
}
|
}
|
|
// public void CustomPowerUp(ulong nowPower ,ulong addPower)
|
// {
|
// prowNum = (long)nowPower;
|
// prowNumChange = (long)addPower;
|
// isAdd = true;
|
// if (UIManager.Instance.IsOpened<PowerAddWin>())
|
// {
|
// AddPowerEvent?.Invoke();
|
// return;
|
// }
|
// UIManager.Instance.OpenWindow<PowerAddWin>();
|
// }
|
|
|
}
|
|
|
|
|
|