Ejemplo n.º 1
0
 public void CollectTileMethod()
 {
     foreach (Transform t in tankTile.transform)
     {
         var rd  = t.gameObject.GetComponent <RoomData>();
         var par = new GameObject(t.name);
         par.transform.parent = this.transform;
         Util.InitGameObject(par.gameObject);
         foreach (var roomPosRot in rd.Prefabs)
         {
             if (roomPosRot.prefab != null)
             {
                 var g = PrefabUtility.InstantiatePrefab(roomPosRot.prefab) as GameObject;
                 g.transform.parent   = par.transform;
                 g.transform.position = roomPosRot.pos;
                 //if (roomPosRot.rot.x != 0)
                 {
                     g.transform.rotation = roomPosRot.rot;
                 }
                 if (roomPosRot.scale.x != 0)
                 {
                     g.transform.localScale = roomPosRot.scale;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void UpdateEditor()
        {
#if UNITY_EDITOR
            if (!EditorApplication.isPlaying)
            {
                if (NpcId != -1)
                {
                    var mData = GMDataBaseSystem.database.SearchId <NpcConfigData>(GameData.NpcConfig, NpcId);
                    if (mData != null)
                    {
                        Resource = Resources.Load <GameObject>(mData.model);
                    }

                    if (oldResource != Resource)
                    {
                        ClearChildren();

                        if (Resource != null)
                        {
                            var showRes = GameObject.Instantiate(Resource) as GameObject;
                            showRes.transform.parent = transform;
                            Util.InitGameObject(showRes);
                        }
                        oldResource = Resource;
                    }
                }
            }
#endif
        }
Ejemplo n.º 3
0
 void UpdateFrame()
 {
     foreach (var c in Cells)
     {
         GameObject.Destroy(c);
     }
     Cell.SetActive(false);
     for (int i = 0; i < BackPack.MaxBackPackNumber; i++)
     {
         var item = GameInterface_Package.playerPackage.EnumItem(GameInterface_Package.PackagePageEnum.All, i);
         var temp = item;
         if (item != null && item.itemData.IsGem())
         {
             var count = CheckContainGem(item.id);
             if (item.entry.Count > count)
             {
                 var c = GameObject.Instantiate(Cell) as GameObject;
                 c.name             = "" + item.id;
                 c.transform.parent = Cell.transform.parent;
                 Util.InitGameObject(c);
                 c.SetActive(true);
                 var pak = c.GetComponent <PackageItem>();
                 pak.SetData(item, count);
                 pak.SetButtonCB(delegate()
                 {
                     PutInGem(temp);
                 });
                 Cells.Add(c);
             }
         }
     }
     StartCoroutine(WaitReset());
 }
Ejemplo n.º 4
0
        void ExportRoomPieces(GameObject g)
        {
            var saveData = new GameObject("RoomPieces_data");

            saveData.AddComponent <RoomData>();
            saveData.transform.parent = g.transform;
            Util.InitGameObject(saveData);

            var resPath = Path.Combine(Application.dataPath, "prefabs");
            var dir     = new DirectoryInfo(resPath);
            var prefabs = dir.GetFiles("*.prefab", SearchOption.TopDirectoryOnly);

            resPath = Path.Combine(Application.dataPath, "prefabs/props");
            dir     = new DirectoryInfo(resPath);
            var propsPrefab = dir.GetFiles("*.prefab", SearchOption.TopDirectoryOnly);


            GameObjectDelegate gg = delegate(string name)
            {
                return(GetPrefab(name, new List <FileInfo[]>()
                {
                    prefabs,
                    propsPrefab
                }));
            };

            TranverseTree(transform.Find("RoomPieces_data").gameObject, saveData, gg);
        }
Ejemplo n.º 5
0
        void InitList()
        {
            foreach (var c in Cells)
            {
                GameObject.Destroy(c);
            }
            Cell.SetActive(false);

            for (int i = 0; i < gems.Count; i++)
            {
                var item = gems[i];
                var temp = item;
                if (item != null)
                {
                    var c = GameObject.Instantiate(Cell) as GameObject;
                    c.transform.parent = Cell.transform.parent;
                    Util.InitGameObject(c);
                    c.SetActive(true);
                    var pak = c.GetComponent <PackageItem>();
                    pak.SetData(item, 0, false);
                    pak.SetButtonCB(delegate(){
                        TakeOffGem(temp);
                    });
                    Cells.Add(c);
                }
            }

            Grid.repositionNow = true;
        }
Ejemplo n.º 6
0
        void UpdateFrame()
        {
            foreach (var c in Cells)
            {
                GameObject.Destroy(c);
            }
            Cell.SetActive(false);
            var eq = BackPack.backpack.GetEquipmentData();

            for (int i = 0; i < eq.Count; i++)
            {
                var item = eq[i];
                if (item != null)
                {
                    var c = GameObject.Instantiate(Cell) as GameObject;
                    c.transform.parent = Cell.transform.parent;
                    Util.InitGameObject(c);
                    c.SetActive(true);
                    var pak = c.GetComponent <PackageItem>();
                    pak.SetEquipData(item);

                    Cells.Add(c);
                }
            }

            Grid.repositionNow = true;
        }
Ejemplo n.º 7
0
        private void Awake()
        {
            attribute = GetComponent <NpcAttribute>();
            attribute.ShowBloodBar = false;
            ai           = new ChestCharacter();
            ai.attribute = attribute;
            ai.AddState(new ChestIdle());

            Util.SetLayer(gameObject, GameLayer.IgnoreCollision2);


            var st  = attribute.spawnTrigger;
            var sz  = st.GetComponent <SpawnZone>();
            var old = sz.GetComponent <BoxCollider>();
            var go  = new GameObject();

            go.transform.parent = transform;
            var bc = go.AddComponent <BoxCollider>();

            bc.isTrigger = true;
            bc.center    = old.center;
            bc.size      = old.size;
            Util.InitGameObject(go);
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = sz.transform.localScale;

            var wz = go.AddComponent <WarnZone>();

            wz.light = sz.transform.Find("light").gameObject;
        }
Ejemplo n.º 8
0
        void SetData()
        {
            var allJobs = GameData.RoleJobDescriptions;

            while (cells.Count < allJobs.Count)
            {
                var c = GameObject.Instantiate <GameObject>(cell);
                c.transform.parent = grid.transform;
                Util.InitGameObject(c);
                cells.Add(c);
            }

            foreach (var c in cells)
            {
                c.SetActive(false);
            }

            var i = 0;

            foreach (var j in allJobs)
            {
                var id = j.id;
                var n  = j.job;
                var c  = cells[i];
                var hc = c.GetComponent <HeroCell>();
                hc.SetData(id, n);
                c.SetActive(true);
                i++;
            }
            grid.repositionNow = true;
        }
Ejemplo n.º 9
0
        void UpdateFrame()
        {
            foreach (var c in Cells)
            {
                GameObject.Destroy(c);
            }
            Cell.SetActive(false);
            for (int i = 0; i < BackPack.MaxBackPackNumber; i++)
            {
                var item = GameInterface_Package.playerPackage.EnumItem(GameInterface_Package.PackagePageEnum.All, i);
                if (item != null && item.packInfo != null && item.itemData != null)
                {
                    Log.GUI("PackageRight is " + item.packInfo + " slot is " + item.InstanceID);
                    var c = GameObject.Instantiate(Cell) as GameObject;
                    c.transform.parent = Cell.transform.parent;
                    Util.InitGameObject(c);
                    c.SetActive(true);
                    var pak = c.GetComponent <PackageItem>();
                    pak.SetData(item);
                    Cells.Add(c);
                }
            }

            Grid.repositionNow = true;
        }
Ejemplo n.º 10
0
        IEnumerator LoadRoom(GameObject roomConfig, bool slowly = false)
        {
            var pieces = roomConfig.transform.Find("RoomPieces_data");
            var rd     = pieces.GetComponent <RoomData>();
            var root   = GameObject.Find("Root_" + currentRoomIndex);

            var rootOfPieces = new GameObject("RoomPieces");

            rootOfPieces.transform.parent = root.transform;
            Util.InitGameObject(rootOfPieces);

            int c = 0;

            //Batch Rooom
            foreach (var p in  rd.Prefabs)
            {
                if (p != null && p.prefab != null)
                {
                    var r = GameObject.Instantiate(p.prefab) as GameObject;
                    r.isStatic                = true;
                    r.transform.parent        = rootOfPieces.transform;
                    r.transform.localPosition = p.pos;
                    r.transform.localRotation = p.rot;
                    r.transform.localScale    = p.scale;
                }
                c++;
                if (slowly && c >= batchNum)
                {
                    c = 0;
                    yield return(null);
                }
            }
            Log.Sys("LoadRoomFinish " + roomConfig.name + " num " + rd.Prefabs.Count);
            yield return(null);
        }
Ejemplo n.º 11
0
        IEnumerator LoadLight(GameObject roomConfig, bool slowly = false)
        {
            var light       = roomConfig.transform.Find("light_data");
            var rd          = light.GetComponent <RoomData>();
            var root        = GameObject.Find("Root_" + currentRoomIndex);
            var rootOfLight = new GameObject("Light");

            rootOfLight.transform.parent = root.transform;
            Util.InitGameObject(rootOfLight);

            //Batch Rooom
            int c = 0;

            foreach (var p in  rd.Prefabs)
            {
                var r = GameObject.Instantiate(p.prefab) as GameObject;
                r.isStatic                = true;
                r.transform.parent        = rootOfLight.transform;
                r.transform.localPosition = p.pos;
                r.transform.localRotation = p.rot;
                r.transform.localScale    = p.scale;
                c++;
                if (slowly && c > batchNum)
                {
                    c = 0;
                    yield return(null);
                }
            }
            Log.Sys("LoadLightFinish " + roomConfig.name + " num " + rd.Prefabs.Count);
            yield return(null);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 加载某个房间的邻居
        /// 进入某个房间正在加载,而又有了加载Neibor的请求
        /// </summary>
        /// <returns>The current room neibor.</returns>
        public IEnumerator LoadRoomNeibor()
        {
            Log.Sys("LoadRoomNeibor");
            var nextRoom = currentRoomIndex + 1;

            if (loadedRoom.Contains(nextRoom) || configLists.Count <= nextRoom)
            {
                yield break;
            }
            if (inLoad)
            {
                loadRequest.Add(currentRoomIndex + 1);
                yield break;
            }

            inLoad = true;
            //InitNamePieces();

            currentRoomIndex++;
            loadedRoom.Add(currentRoomIndex);

            var root = new GameObject("Root_" + currentRoomIndex); //FirstRoom

            Util.InitGameObject(root);

            var first       = configLists [currentRoomIndex];
            var firstOffset = new Vector3(first.x * 96, 9, first.y * 96 + 48);

            Log.Sys("FirstRoom " + first.room);
            root.transform.localPosition = firstOffset;
            if (first.flip)
            {
                root.transform.localScale = new Vector3(-1, 1, 1);
            }

            //var piece = namePieces [first.room];
            //var roomConfig = Resources.Load<GameObject>("room/" + piece);
            var roomConfig = RoomList.GetStaticObj(first.type, first.room);

            yield return(StartCoroutine(LoadRoom(roomConfig, true)));

            yield return(null);

            yield return(StartCoroutine(LoadLight(roomConfig, true)));

            yield return(StartCoroutine(LoadProps(roomConfig, true)));

            yield return(StartCoroutine(LoadZone()));

            yield return(null);

            inLoad = false;

            if (loadRequest.Count > 0)
            {
                Log.Sys("Cache Load Request");
                loadRequest.RemoveAt(0);
                StartCoroutine(LoadRoomNeibor());
            }
        }
Ejemplo n.º 13
0
        void AddChildren()
        {
            foreach (var g in parts)
            {
                if (g.g != null)
                {
                    var nb     = GameObject.Instantiate(g.g) as GameObject;
                    var oldRot = nb.transform.localRotation;
                    nb.transform.parent = transform;
                    Util.InitGameObject(nb);
                    nb.transform.localRotation = oldRot;
                    if (g.rotY != 0)
                    {
                        nb.transform.localRotation = Quaternion.Euler(new Vector3(oldRot.eulerAngles.x, g.rotY, oldRot.eulerAngles.z));
                    }

                    nb.transform.localPosition = g.pos;
                    if (g.scale.x != 0)
                    {
                        nb.transform.localScale = g.scale;
                    }
                    else
                    {
                        nb.transform.localScale = Vector3.one;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        void UpdateFrame()
        {
            foreach (var c in Cells)
            {
                GameObject.Destroy(c);
            }
            Cell.SetActive(false);
            foreach (var id in storeList)
            {
                var c = GameObject.Instantiate(Cell) as GameObject;
                c.transform.parent = Cell.transform.parent;
                Util.InitGameObject(c);
                c.SetActive(true);
                var pak = c.GetComponent <StoreItem>();
                pak.SetId(this, id);
                Cells.Add(c);
            }
            Grid.repositionNow = true;


            var me = ObjectManager.objectManager.GetMyData();

            goldNum.text = "金币: " + me.GetProp(CharAttribute.CharAttributeEnum.GOLD_COIN);
            JNum.text    = "晶石: " + ServerData.Instance.playerInfo.JingShi;
        }
Ejemplo n.º 15
0
        private void InitChat()
        {
            foreach (var chatInfo in ChatData.Instance.chatInfo)
            {
                var ord = chatInfo.ord;
                if (ord >= chatId)
                {
                    var cell = GameObject.Instantiate(Cell) as GameObject;
                    cell.transform.parent = Cell.transform.parent;
                    Util.InitGameObject(cell);
                    cell.SetActive(true);
                    var cc = cell.GetComponent <ChatCell>();
                    cc.Name.text               = chatInfo.who;
                    cc.Content.text            = chatInfo.content;
                    cc.transform.localPosition = new Vector3(0, -cells.Count * 50, 0);
                    cells.Enqueue(cell);
                    chatId = ord + 1;
                }
            }
            while (cells.Count >= 30)
            {
                var d = cells.Dequeue();
                GameObject.Destroy(d);
            }

            StartCoroutine(WaitReset());
        }
Ejemplo n.º 16
0
        void UpdateFrame()
        {
            foreach (var c in cells)
            {
                GameObject.Destroy(c);
            }
            cells.Clear();

            gNum.text = "技能点:" + GameInterface_Skill.skillInterface.GetLeftSp();
            var skillList = GameInterface_Skill.skillInterface.GetActiveSkill();

            for (int i = 0; i < skillList.Count; i++)
            {
                var data = skillList[i];
                var nc   = GameObject.Instantiate(cell) as GameObject;
                nc.SetActive(true);
                nc.transform.parent = cell.transform.parent;
                Util.InitGameObject(nc);

                var c            = nc.GetComponent <SkillCell>();
                var nextLevSkill = Util.GetSkillData(data.skillId, data.level + 1);
                c.SetSkillName(data.skillId, data.skillData.SkillName, data.level, nextLevSkill.LevelRequired, data.skillData.SkillDes, data.skillData.MaxLevel);

                c.SetCb(delegate() {
                    GameInterface_Skill.skillInterface.SkillLevelUp(data.skillId);
                });
                cells.Add(nc);
            }

            grid.repositionNow = true;
        }
Ejemplo n.º 17
0
        private void UpdateFrame()
        {
            var score = ScoreManager.Instance.score;

            while (cells.Count < score.Count)
            {
                var g = Object.Instantiate(cell) as GameObject;
                g.transform.parent = cell.transform.parent;
                Util.InitGameObject(g);
                cells.Add(g);
                g.SetActive(false);
            }
            foreach (var c in cells)
            {
                c.SetActive(false);
            }
            var keys = score.Keys.ToList();

            keys.Sort((a, b) =>
            {
                var ad = score[a];
                var bd = score[b];
                if (ad.killed > bd.killed)
                {
                    return(-1);
                }
                if (ad.killed < bd.killed)
                {
                    return(1);
                }
                return(0);
            });

            var rank = 0;

            for (var i = 0; i < keys.Count; i++)
            {
                var k      = keys[i];
                var player = ObjectManager.objectManager.GetPlayer(k);
                if (player != null)
                {
                    var un = player.GetComponent <NpcAttribute>().userName;
                    if (!string.IsNullOrEmpty(un))
                    {
                        ScoreManager.Instance.UpdateCacheName(k, un);
                        var g = cells[i];
                        g.SetActive(true);
                        g.GetComponent <RealtimeCell>().SetData(rank + 1, un, score[k].killed, score[k].serverId, score[k].killCount, score[k].deadCount, score[k].assistCount);
                        rank++;
                    }
                }
                else
                {
                    ScoreManager.Instance.RemoveCacheName(k);
                }
            }
            StartCoroutine(WaitReset());
        }
Ejemplo n.º 18
0
        void Awake()
        {
            bar = GameObject.Instantiate(Resources.Load <GameObject>("UI/BloodBar")) as GameObject;
            bar.transform.parent = WindowMng.windowMng.GetUIRoot().transform;
            Util.InitGameObject(bar);
            var barUI = bar.gameObject.AddComponent <BloodBarUI>();

            label       = barUI.GetLabel("Label");
            masterLabel = barUI.GetLabel("MasterLabel");
            fill        = bar.GetComponent <UISlider>();
        }
Ejemplo n.º 19
0
        public void UpdateFrame()
        {
            if (mailInfoList.Count == 0)
            {
                GetName("MailNoneDetailPanel").SetActive(true);
                GetName("MailDetailPanel").SetActive(false);
            }
            else
            {
                GetName("MailNoneDetailPanel").SetActive(false);
                GetName("MailDetailPanel").SetActive(true);
            }

            while (cells.Count < mailInfoList.Count)
            {
                var g = Object.Instantiate(cell) as GameObject;
                g.transform.parent = cell.transform.parent;
                Util.InitGameObject(g);
                cells.Add(g);
                g.SetActive(false);
            }
            foreach (var c in cells)
            {
                c.SetActive(false);
            }

            mailInfoList.Sort((obj1, obj2) =>
            {
                return(obj2.id.CompareTo(obj1.id));
            });


            for (var i = 0; i < mailInfoList.Count; i++)
            {
                var g = cells[i];
                g.SetActive(true);
                g.GetComponent <MailCell>()
                .SetData(i, mailInfoList[i]);
            }

            if (mailInfoList.Count > 0)
            {
                currentSelectedIndex = Mathf.Clamp(currentSelectedIndex, 0, mailInfoList.Count - 1);
                ShowDetailMailInfo();
            }


            StartCoroutine(WaitReset());
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 关卡房间相关怪物配置
        /// level_1_4_0
        /// 网络游戏 怪物实例是由Master 负责生成和管理的
        /// 不加载properties下面的对象
        /// 动态对象
        /// 其它的是静态对象
        /// </summary>
        /// <returns>The zones.</returns>
        IEnumerator LoadZone()
        {
            var roomConfig = configLists [currentRoomIndex];
            int index      = currentRoomIndex;

            if (roomConfig.useOtherZone)
            {
                index = roomConfig.zoneId;
                if (zoneId != 0)
                {
                    index = zoneId;
                }
            }

            var name       = "zones/level_1_4_" + index;
            var root       = GameObject.Find("Root_" + currentRoomIndex);
            var zoneConfig = Resources.Load <GameObject>(name);

            if (zoneConfig == null)
            {
                Log.Sys("LoadZoneConfig Error " + name);
                yield break;
            }
            var zone = GameObject.Instantiate(zoneConfig) as GameObject;
            var ze   = zone.AddComponent <ZoneEntityManager>();

            var world = WorldManager.worldManager.GetActive();

            Log.Sys("WorldIs Net: " + world.IsNet + " act " + world + " pro ");
            if (world.IsNet)
            {
                //pro.gameObject.AddComponent<TestDisable>();
                //pro.gameObject.SetActive(false);
                ze.DisableProperties();
            }

            if (zone == null)
            {
                Debug.LogError("LoadZone Null " + zone + " config " + zoneConfig);
            }

            zone.transform.parent = root.transform;
            Util.InitGameObject(zone);
            loadedZone [currentRoomIndex] = zone;
            BattleManager.battleManager.AddZone(zone);

            yield return(null);
        }
Ejemplo n.º 21
0
        void Awake()
        {
            var mc = Camera.main;
            var ca = gameObject.AddComponent <Camera>();

            ca.cullingMask      = 1 << (int)GameLayer.SkillLight;
            ca.clearFlags       = CameraClearFlags.SolidColor;
            ca.backgroundColor  = new Color(0, 0, 0, 0);
            ca.orthographic     = false;
            ca.fieldOfView      = Camera.main.fieldOfView;
            ca.nearClipPlane    = mc.nearClipPlane;
            ca.farClipPlane     = mc.farClipPlane;
            ca.targetTexture    = GraphInit.Instance.skillLight;
            ca.transform.parent = mc.transform;
            Util.InitGameObject(gameObject);
        }
Ejemplo n.º 22
0
        void Awake()
        {
            attribute = GetComponent <NpcAttribute>();
            attribute.ShowBloodBar = false;
            ai           = new ChestCharacter();
            ai.attribute = attribute;

            ai.AddState(new ChestIdle());
            ai.AddState(new NotMoveDead());
            ai.AddState(new MonsterKnockBack());
            Util.SetLayer(gameObject, GameLayer.IgnoreCollision2);

            var g = new GameObject("AddHP");

            g.transform.parent = transform;
            Util.InitGameObject(g);
            g.AddComponent <AddHPComponent>();
        }
Ejemplo n.º 23
0
        void Awake()
        {
            bar = GameObject.Instantiate(Resources.Load <GameObject>("UI/BloodBar")) as GameObject;
            bar.transform.parent = WindowMng.windowMng.GetUIRoot().transform;
            Util.InitGameObject(bar);
            var barUI = bar.gameObject.AddComponent <BloodBarUI>();

            label = barUI.GetLabel("SkillLabel");
            label.gameObject.SetActive(false);
            masterLabel = barUI.GetLabel("MasterLabel");
            NameLabel   = barUI.GetLabel("NameLabel");

            fill    = new UISlider[1];
            fill[0] = bar.transform.Find("BloodBarAnchor/BloodBar1").gameObject.GetComponent <UISlider>();
            //fill[1] = bar.transform.FindChild("BloodBarAnchor/BloodBar2").gameObject.GetComponent<UISlider>();
            //fill[2] = bar.transform.FindChild("BloodBarAnchor/BloodBar3").gameObject.GetComponent<UISlider>();
            //fill[3] = bar.transform.FindChild("BloodBarAnchor/BloodBar4").gameObject.GetComponent<UISlider>();
        }
Ejemplo n.º 24
0
        //EnterScene
        //ExitScene
        void Awake()
        {
            var go = new GameObject("NearMainCameraTrigger");

            go.transform.parent = gameObject.transform.parent;
            Util.InitGameObject(go);
            go.transform.position = gameObject.transform.position;

            var col = go.AddComponent <SphereCollider>();
            var tri = go.AddComponent <NearTrigger>();

            tri.connectObject = gameObject;

            col.radius    = 2;
            col.isTrigger = true;
            go.layer      = (int)GameLayer.SceneProps;
            gameObject.SetActive(false);
        }
Ejemplo n.º 25
0
        public void SetData(Dictionary <int, ScoreData> score)
        {
            while (cells.Count < score.Count)
            {
                var g = Object.Instantiate(cell) as GameObject;
                g.transform.parent = cell.transform.parent;
                Util.InitGameObject(g);
                cells.Add(g);
                g.SetActive(false);
            }
            foreach (var c in cells)
            {
                c.SetActive(false);
            }
            var keys = score.Keys.ToList();

            keys.Sort((a, b) =>
            {
                var ad = score [a];
                var bd = score [b];
                if (ad.killed > bd.killed)
                {
                    return(-1);
                }
                if (ad.killed < bd.killed)
                {
                    return(1);
                }
                return(0);
            });

            for (var i = 0; i < keys.Count; i++)
            {
                var k      = keys [i];
                var player = ObjectManager.objectManager.GetPlayer(k);
                if (player != null)
                {
                    var g = cells [i];
                    g.SetActive(true);
                    IUserInterface.SetText(g, "Name", player.GetComponent <NpcAttribute>().userName + ": " + score [k].killed + "");
                }
            }
            StartCoroutine(WaitReset());
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 加载第一个房间
        /// </summary>
        /// <returns>The first room.</returns>
        public IEnumerator LoadFirstRoom()
        {
            Log.Sys("LoadFirstRoom");
            currentRoomIndex = 0;
            loadedRoom.Add(currentRoomIndex);

            var root = new GameObject("Root_0"); //FirstRoom

            Util.InitGameObject(root);

            var first = configLists [0];

            Log.Sys("First Room NamePices " + first.room);
            if (string.IsNullOrEmpty(first.room))
            {
            }
            else
            {
                var roomConfig = RoomList.GetStaticObj(first.type, first.room);
                yield return(StartCoroutine(LoadRoom(roomConfig)));

                yield return(null);

                yield return(StartCoroutine(LoadLight(roomConfig)));

                yield return(StartCoroutine(LoadProps(roomConfig)));
            }

            yield return(StartCoroutine(LoadZone()));

            var zone = loadedZone [currentRoomIndex];

            //单一出生点位置
            var zoneConfigStart = zone.transform.Find("PlayerStart");

            if (zoneConfigStart != null)
            {
                var g = new GameObject("PlayerStart");
                g.transform.position = zoneConfigStart.transform.position;
            }
            InitYet = true;
        }
Ejemplo n.º 27
0
        private void Start()
        {
            //StartCoroutine(AutoEnemy());
            var attr = NetworkUtil.GetAttr(gameObject);

            if (attr.IsMine())
            {
                var shootManager = new GameObject("ShootManager");
                shootManager.transform.parent = transform;
                Util.InitGameObject(shootManager);
                var sm = shootManager.AddComponent <ShootManager>();
                sm.autoCheck = this;
            }
            else
            {
                StartCoroutine(SynDir());
            }

            InitTowerTrace();
        }
Ejemplo n.º 28
0
        void Start()
        {
            for (var i = 0; i < tank.Count; i++)
            {
                var n = tank [i];
                //var c = Object.Instantiate(cell) as GameObject;
                var c = NGUITools.AddChild(cell.transform.parent.gameObject, cell);
                items.Add(c);
                c.SetActive(true);
                //c.transform.parent = cell.transform.parent;

                Util.InitGameObject(c);
                IUserInterface.SetText(c, "Name", n);
                var temp = i;
                c.GetComponent <IUserInterface>().SetCallback("Info", () =>
                {
                    OnSelect(temp);
                });
            }
            grid.repositionNow = true;
        }
Ejemplo n.º 29
0
        void UpdateFrame()
        {
            foreach (var c in Cells)
            {
                GameObject.Destroy(c);
            }
            Cell.SetActive(false);
            foreach (var id in chargeList)
            {
                var c = GameObject.Instantiate(Cell) as GameObject;
                c.transform.parent = Cell.transform.parent;
                Util.InitGameObject(c);
                c.SetActive(true);
                var pak = c.GetComponent <ChargeItem>();
                pak.SetCharge(this, id);
                Cells.Add(c);
            }
            Grid.repositionNow = true;

            JingShi.text = "晶石: " + ServerData.Instance.playerInfo.JingShi;
        }
Ejemplo n.º 30
0
        void Awake()
        {
            attribute = GetComponent <NpcAttribute>();
            attribute.ShowBloodBar = false;
            ai           = new ChestCharacter();
            ai.attribute = attribute;
            var bd = new HideDead();

            ai.AddState(new ChestIdle());
            ai.AddState(bd);
            ai.AddState(new MonsterKnockBack());

            Util.SetLayer(gameObject, GameLayer.IgnoreCollision2);

            var g = new GameObject("HideBloodBar");

            g.transform.parent = transform;
            Util.InitGameObject(g);
            var hb = g.AddComponent <HideBloodBar>();

            bd.deadCallback = hb.RestoreAll;
        }