Ejemplo n.º 1
0
 public ClientCreator(WarClientManager mgr)
 {
     warMgr    = mgr;
     Maploader = Core.ResEng.getLoader <PrefabLoader>();
     Npcloader = Core.ResEng.getLoader <NpcLoader>();
     reader    = Core.Data.getIModelConfig <SceneEditorDataRead>();
 }
Ejemplo n.º 2
0
        public void NpcSkillCD(IpcSkillMsg msg)
        {
            NpcSkillAttr attr = new NpcSkillAttr()
            {
                npcId      = msg.uniqueID,
                skillIndex = msg.index,
                baseCd     = msg.baseCD,
                cdValue    = msg.baseCD,
                isInCd     = true,
            };

            AsyncTask.QueueOnMainThread(
                () =>
            {
                WarClientManager mgr = WarClientManager.Instance;
                if (mgr != null)
                {
                    ClientNPC npc = mgr.npcMgr.GetNpc(msg.uniqueID);
                    if (npc != null)
                    {
                        npc.AddSkillAttr(msg.index, attr);
                    }
                }
            }
                );
        }
Ejemplo n.º 3
0
        // Use this for initialization
        public virtual void Start()
        {
//            cachedTran = transform;
//            animator = GetComponent<Animator>();
            attackPoint = transform.FindChild("AttackPoint");
            views       = GetComponentsInChildren <Renderer>();
            cliMgr      = WarClientManager.Instance;
            modelInfo   = new CharacterModel();
            modelInfo.Init(cachedTran);
        }
Ejemplo n.º 4
0
        // Use this for initialization
        void Start()
        {
            warCliMgr = WarClientManager.Instance;
            if (warCliMgr != null)
            {
                proxyServer = warCliMgr.realCli.proxyServer;
                warCliMgr.realCli.Switch       = On_SwitchHero_Ok;
                warCliMgr.realCli.Auto         = On_Auto_OK;
                warCliMgr.onCreateHeroFinished = OnCreateHerFinished;
            }
//            StartCoroutine(DelayInitUI());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 战斗的入口在这里
        /// </summary>
        void Awake()
        {
            Instance         = this;
            mainCameraFollow = Main3DCamera.GetComponent <CameraFollow>();

            ///
            /// 获得NPC管理容器
            ///
            npcMgr = new WarClientNpcMgr();
            npcMgr.Init();
            //初始化场景的创建器
            creator = new ClientCreator(this);

            Shake      = Main3DCamera.GetComponent <ShakeCamera>();
            AutoBattle = false;
        }
Ejemplo n.º 6
0
        public void OnHeroSelected(int id)
        {
            Debug.Log("switch to npc : " + id);
            WarClientManager mgr = WarClientManager.Instance;

            if (mgr != null)
            {
                cachedNpc = mgr.npcMgr.GetNpc(id);
                if (cachedNpc != null)
                {
                    string name = cachedNpc.data.configData.model + "_skill_" + index;
                    sprite.spriteName = name;
                    attr = cachedNpc.GetSkillAttr(index - 1);
                }
            }
        }
Ejemplo n.º 7
0
 //npc血量变化
 public void NPChp(IpcNpcHpMsg msg)
 {
     ConsoleEx.DebugLog(war.Side.ToString() + " Sub Received : NPChp.", ConsoleEx.YELLOW);
     AsyncTask.QueueOnMainThread(
         () => {
         int id = msg.uniqueId;
         WarClientManager mgr = WarClientManager.Instance;
         if (mgr != null)
         {
             ClientNPC npc = mgr.npcMgr.GetNpc(id);
             if (npc != null)
             {
                 npc.UpdateHp(msg);
             }
         }
     });
 }
Ejemplo n.º 8
0
 public void NpcDestroy(IpcDestroyNpcMsg msg)
 {
     AsyncTask.QueueOnMainThread(
         () => {
         int id = msg.id;
         WarClientManager mgr = WarClientManager.Instance;
         if (mgr != null)
         {
             ClientNPC npc = mgr.npcMgr.GetNpc(id);
             if (npc != null)
             {
                 WarMsgParam param = new WarMsgParam();
                 param.cmdType     = WarMsg_Type.Destroy;
                 mgr.npcMgr.SendMessageAsync(id, id, param);
             }
         }
     });
 }
Ejemplo n.º 9
0
 //npc动画
 public void NPCAnim(IpcNpcAnimMsg msg)
 {
     //ConsoleEx.DebugLog(war.Side.ToString() + " Sub Received : NPCAnim.", ConsoleEx.YELLOW);
     AsyncTask.QueueOnMainThread(
         () => {
         WarMsgParam param = new WarMsgParam();
         param.cmdType     = (WarMsg_Type)Enum.Parse(typeof(WarMsg_Type), msg.nextAnim);
         if (!string.IsNullOrEmpty(msg.data))
         {
             param.param = msg.data;
         }
         WarClientManager mgr = WarClientManager.Instance;
         if (mgr != null)
         {
             mgr.npcMgr.SendMessageAsync(msg.uniqueId, msg.uniqueId, param);
         }
     });
 }
Ejemplo n.º 10
0
 public void Init(AnimationMsg msg)
 {
     wmMgr = WarClientManager.Instance;
     tran  = transform;
     if (msg != null)
     {
         speed  = msg.arg1;
         maxDis = msg.arg2;
         if (wmMgr != null)
         {
             BNPC npc = wmMgr.npcMgr.GetNpc(msg.targetId);
             if (npc != null)
             {
                 Target = npc.transform;
             }
         }
     }
     inited = true;
 }
Ejemplo n.º 11
0
        public override void SetItemController(WarUI root)
        {
            rootUI             = root;
            root.onHeroSwitch += OnHeroSelected;
            WarClientManager mgr = WarClientManager.Instance;

            if (mgr != null)
            {
                ClientNPC npc = mgr.clientTeam.get(index);
                if (npc != null)
                {
                    cachedNpc = npc;
                    npc.animState.HeroHealthBar = health;
                    string name = "head_" + npc.data.configData.model;
                    head.spriteName = name;
                }
                else
                {
                    gameObject.SetActive(false);
                }
            }
        }