示例#1
0
        void OnD2L_BattleInit(UFrame.MessageCenter.Message msg)
        {
            D2L_BattleInit convMsg = msg as D2L_BattleInit;

            if (convMsg.result)
            {
                displayOK = true;
                Debug.LogError("display init ok");
            }
        }
示例#2
0
        void OnL2D_BattleInit(UFrame.MessageCenter.Message msg)
        {
            L2D_BattleInit initMsg = msg as L2D_BattleInit;

            for (int i = 0; i < initMsg.tankGroup.Count; ++i)
            {
                tank_info        ti         = tank_infoAPI.GetDataBy_tank_type(initMsg.tankGroup[i].tank_type);
                GameObjectGetter tankGetter = ResHelper.LoadGameObject(ti.res_path);
                GameObject       tankGo     = tankGetter.Get();
                tankGo.transform.position = initMsg.tankGroup[i].pos;
                Debug.LogError(initMsg.tankGroup[i].dir);
                tankGo.transform.transform.LookAt(initMsg.tankGroup[i].dir);
                var tank = new Tank();
                tank.go        = tankGo;
                tank.ID        = initMsg.tankGroup[i].id;
                tank.dectLen   = initMsg.tankGroup[i].detectionLen;
                tank.dectWidth = initMsg.tankGroup[i].detectionWidth;
                tanks.Add(initMsg.tankGroup[i].id, tank);

                Debug.LogError(initMsg.tankGroup[i].id + " " + initMsg.tankGroup[i].isPlayer);
                //增加跟随相机
                //if (initMsg.tankGroup[i].isSelf && initMsg.tankGroup[i].isCaptain)
                //{
                //    GameObjectGetter selfCameraGetter = ResHelper.LoadGameObject("prefabs/self_camera");
                //    GameObject selfCamera = selfCameraGetter.Get();
                //    //RPGCamera rpgCamera = selfCamera.GetComponent<RPGCamera>();
                //    //rpgCamera.UsedCamera = Camera.main;
                //    selfCamera.transform.SetParent(tank.transform);
                //}
            }

            for (int i = 0; i < initMsg.avoidances.Count; ++i)
            {
                //tank_info ti = tank_infoAPI.GetDataBy_tank_type(initMsg.tankGroup[i].tank_type);
                GameObjectGetter getter = ResHelper.LoadGameObject("prefabs/avoidance3");
                GameObject       av     = getter.Get();
                av.transform.position = initMsg.avoidances[i].pos;
                //av.transform.localScale *= (initMsg.avoidances[i].rad);
            }

            D2L_BattleInit initRetMsg = new D2L_BattleInit();

            initRetMsg.result = true;
            battleManager.battleMessageCenter.Send(initRetMsg);
        }