Exemplo n.º 1
0
 /// <summary>
 /// 减少当前的生命值(例如:被敌人攻击)
 /// </summary>
 /// <param name="attack"></param>
 public void SubCurHP(float attack)
 {
     if (attack > 0)
     {
         Mod_PlayerKernelDataProxy.GetInstance().SubCurHP(attack);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 读取玩家的核心数据
        /// </summary>
        private void LoadFromXML_PlayerKernalData()
        {
            //参数检查
            if (string.IsNullOrEmpty(_FileNameByPlayerKernalData))
            {
                Debug.LogError("读取玩家核心参数失败!");
                return;
            }

            try {
                //读取XML数据
                string strTemp = XmlOperation.GetInstance().LoadXML(_FileNameByPlayerKernalData);
                //反序列化
                Mod_PlayerKernelData pkd = XmlOperation.GetInstance().DeserializeObject(strTemp, typeof(Mod_PlayerKernelData)) as Mod_PlayerKernelData;
                //赋值
                Mod_PlayerKernelDataProxy.GetInstance().CurHP     = pkd.CurHP;
                Mod_PlayerKernelDataProxy.GetInstance().MaxHP     = pkd.MaxHP;
                Mod_PlayerKernelDataProxy.GetInstance().CurMP     = pkd.CurMP;
                Mod_PlayerKernelDataProxy.GetInstance().MaxMP     = pkd.MaxMP;
                Mod_PlayerKernelDataProxy.GetInstance().ATK       = pkd.ATK;
                Mod_PlayerKernelDataProxy.GetInstance().DEF       = pkd.DEF;
                Mod_PlayerKernelDataProxy.GetInstance().DEX       = pkd.DEX;
                Mod_PlayerKernelDataProxy.GetInstance().ATKByItem = pkd.ATKByItem;
                Mod_PlayerKernelDataProxy.GetInstance().DEFByItem = pkd.DEFByItem;
                Mod_PlayerKernelDataProxy.GetInstance().DEXByItem = pkd.DEXByItem;
            }
            catch {
                Debug.LogError("读取玩家核心参数失败!");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 增加敏捷度
 /// /// </summary>
 /// <param name="addValue"></param>
 public void AddDEX(float addValue)
 {
     if (addValue > 0)
     {
         Mod_PlayerKernelDataProxy.GetInstance().AddDEX(addValue);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 更新敏捷度(例如:当装备新武器时)
 /// </summary>
 public void UpdateDEX(float defByItem = 0)
 {
     if (defByItem > 0)
     {
         Mod_PlayerKernelDataProxy.GetInstance().UpdateDEX(defByItem);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 减少当前的魔法值(例如:使用魔法)
 /// </summary>
 /// <param name="consumption"></param>
 /// <returns>魔法值是否足够</returns>
 public bool SubCurMP(float consumption)
 {
     if (consumption > 0)
     {
         return(Mod_PlayerKernelDataProxy.GetInstance().SubCurMP(consumption));
     }
     return(false);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 更新攻击力(例如:当装备新武器时)
 /// </summary>
 public void UpdateATK(float atkByItem = 0)
 {
     //如果获得了新的武器物品,就更新武器攻击力
     if (atkByItem > 0)
     {
         Mod_PlayerKernelDataProxy.GetInstance().UpdateATK(atkByItem);
     }
 }
Exemplo n.º 7
0
        // Use this for initialization
        void Start()
        {
            Mod_PlayerKernelDataProxy   playerKernelDataObj   = new Mod_PlayerKernelDataProxy(100, 100, 10, 5, 50, 100, 100, 0, 0, 0);
            Mod_PlayerExtendedDataProxy playerExtendedDataObj = new Mod_PlayerExtendedDataProxy(0, 0, 1, 0, 0);


            //显示初始值
            Mod_PlayerKernelDataProxy.GetInstance().DisplayAllOriginalValues();             //调用显示所有初始数据方法
            Mod_PlayerExtendedDataProxy.GetInstance().DisplayAllOriginalValues();           //调用显示所有初始数据方法
        }
Exemplo n.º 8
0
        /// <summary>
        /// 有延迟的开始方法,必须要靠后执行
        /// </summary>
        /// <returns></returns>
        public IEnumerator Start()
        {
            yield return(new  WaitForSeconds(GlobalParameter.WAIT_FOR_SECONDS_ON_START));

            //显示初始值
            Mod_PlayerKernelDataProxy.GetInstance().DisplayAllOriginalValues();             //调用显示所有初始数据方法
            Mod_PlayerExtendedDataProxy.GetInstance().DisplayAllOriginalValues();           //调用显示所有初始数据方法

            //玩家的姓名处理
            if (string.IsNullOrEmpty(GlobalParaMgr.PlayerName))
            {
                Txt_PlayerName.text         = GlobalParaMgr.PlayerName;
                Txt_PlayerNameByDetail.text = GlobalParaMgr.PlayerName;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 公共方法:存储游戏进度
        /// </summary>
        /// <returns>是否保存成功</returns>
        public bool SaveGameProcess()
        {
            //得到各种数据
            //###这里为何要用代理类?
            _PlayerKernelDataProxy   = Mod_PlayerKernelDataProxy.GetInstance();
            _PlayerExtendedDataProxy = Mod_PlayerExtendedDataProxy.GetInstance();
            //_PlayerPackageDataProxy = Mod_PlayerPackageDataProxy.GetInstance();

            //存储游戏的全局参数
            SaveToXML_GlobalParameterData();
            //存储玩家的核心数据
            SaveToXML_GlobalParameterData();
            //存储玩家的扩展数据
            SaveToXML_PlayerExtendedData();
            //存储玩家的背包数据
            SaveToXML_PlayerPackageData();

            return(false);
        }
Exemplo n.º 10
0
 /// <summary>
 /// 得到敏捷度
 /// </summary>
 /// <returns></returns>
 public float GetDEX()
 {
     return(Mod_PlayerKernelDataProxy.GetInstance().GetDEX());
 }
Exemplo n.º 11
0
 /// <summary>
 /// 增加攻击力
 /// </summary>
 /// <param name="addValue"></param>
 public void AddATK(float addValue)
 {
     Mod_PlayerKernelDataProxy.GetInstance().AddATK(addValue);
 }
Exemplo n.º 12
0
 /// <summary>
 /// 得到最大的魔法数值
 /// </summary>
 /// <returns></returns>
 public float GetMaxMana()
 {
     return(Mod_PlayerKernelDataProxy.GetInstance().GetMaxMP());
 }
Exemplo n.º 13
0
 public void DeMP()
 {
     //调用模型层的方法
     Mod_PlayerKernelDataProxy.GetInstance().SubCurMP(60);
 }
Exemplo n.º 14
0
 public void InMP()
 {
     //调用模型层的方法
     Mod_PlayerKernelDataProxy.GetInstance().AddCurMP(60);
 }
Exemplo n.º 15
0
 public void InHP()
 {
     //调用模型层的方法
     // // Debug.Log("调用了InHP方法");
     Mod_PlayerKernelDataProxy.GetInstance().AddCurHP(30);
 }