示例#1
0
        //TODO:玩家升级的逻辑处理  技能点
        void LevelUp()
        {
            //Modify Hp Mp
            Level += 1;
            Exp    = 0;

            Log.Net("AddLevelUp " + IsMine());
            if (IsMine())
            {
                var setSync = CGSetProp.CreateBuilder();
                setSync.Key   = (int)CharAttribute.CharAttributeEnum.EXP;
                setSync.Value = 0;
                KBEngine.Bundle.sendImmediate(setSync);

                var sync = CGAddProp.CreateBuilder();
                sync.Key   = (int)CharAttribute.CharAttributeEnum.LEVEL;
                sync.Value = 1;
                KBEngine.Bundle.sendImmediate(sync);
            }

            Util.ShowLevelUp(Level);
            var par = Instantiate(Resources.Load <GameObject>("particles/events/levelUp")) as GameObject;

            NGUITools.AddMissingComponent <RemoveSelf>(par);
            par.transform.parent   = ObjectManager.objectManager.transform;
            par.transform.position = transform.position;

            if (IsMine())
            {
                //MyEventSystem.myEventSystem.PushEvent(MyEvent.EventType.UpdateMainUI);
                MyEventSystem.myEventSystem.PushEvent(MyEvent.EventType.UpdatePlayerData);
            }
        }
示例#2
0
        IEnumerator  InitGameData()
        {
            GameInterface_Backpack.ClearDrug();
            yield return(StartCoroutine(NetworkUtil.WaitForPlayer()));

            var me = ObjectManager.objectManager.GetMyPlayer();

            GameInterface_Skill.AddSkillBuff(ObjectManager.objectManager.GetMyPlayer(), (int)SkillData.SkillConstId.AddMP, Vector3.zero);
            var attr = me.GetComponent <NpcAttribute>();

            var sync = CGSetProp.CreateBuilder();

            sync.Key   = (int)CharAttribute.CharAttributeEnum.LEVEL;
            sync.Value = 1;
            KBEngine.Bundle.sendImmediate(sync);
            PlayerData.ResetSkillLevel();
        }