示例#1
0
 public override void Awake()
 {
     _icon  = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));
     _count = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Value"));
 }
示例#2
0
 void Start()
 {
     anim = UIUtility.SafeGetComponent <Animation>(transform);
 }
示例#3
0
 private void Start()
 {
     FPS = UIUtility.SafeGetComponent <Text>(transform);
     StartCoroutine(UpdateFPS());
 }
示例#4
0
        /// <summary>
        /// Chunk Generator
        /// </summary>
        /// <param name="originX"></param>
        /// <param name="originZ"></param>
        /// <returns></returns>
        private IEnumerator GenerateCurrentChunks(int originX, int originZ)
        {
            ChunkUpdateList = new List <Chunk>();
            int mapWidth  = MapGenerator.MapWidth;
            int mapLength = MapGenerator.MapLength;

            for (var x = originX - mapWidth; x <= originX + mapWidth; x++)
            {
                for (var z = originZ - mapLength; z <= originZ + mapLength; z++)
                {
                    while (ChunkUpdateList.Count > 0)
                    {
                        ProcessChunkList();
                        if (stopWatch.Elapsed.TotalSeconds >= FrameDuration)
                        {
                            yield return(new WaitForEndOfFrame());
                        }
                    }
                    Chunk currentChunk = GetChunkComponent(x, 0, z);
                    if (currentChunk != null)
                    {
                        if (currentChunk.Fresh)
                        {
                            for (int i = 0; i < 4; i++)
                            {
                                Index      nearbyIndex = currentChunk.ChunkIndex.GetNearbyChunkIndex((Direction)i);
                                GameObject nearbyChunk = GetChunk(nearbyIndex);
                                if (nearbyChunk == null)
                                {
                                    nearbyChunk = Instantiate(ChunkObject, nearbyIndex.ToVector3(), transform.rotation) as GameObject;
                                    nearbyChunk.transform.SetParent(Map);
                                    nearbyChunk.name = new Vector2(nearbyChunk.transform.position.x, nearbyChunk.transform.position.z).ToString();
                                }
                                currentChunk.NearbyChunks[i] = UIUtility.SafeGetComponent <Chunk>(nearbyChunk.transform);
                                if (stopWatch.Elapsed.TotalSeconds >= FrameDuration)
                                {
                                    yield return(new WaitForEndOfFrame());
                                }
                                if (StopSpawning)
                                {
                                    EndSequence();
                                    yield break;
                                }
                            }

                            if (currentChunk != null)
                            {
                                currentChunk.AddToQueueWhenReady();
                            }
                        }
                    }
                    else
                    {
                        GameObject newChunk = Instantiate(ChunkObject, new Vector3(x, 0, z), transform.rotation) as GameObject;
                        newChunk.transform.SetParent(Map);
                        newChunk.name = new Vector2(newChunk.transform.position.x, newChunk.transform.position.z).ToString();
                        currentChunk  = UIUtility.SafeGetComponent <Chunk>(newChunk.transform);
                        for (int i = 0; i < 4; i++)
                        {
                            Index      nearbyIndex = currentChunk.ChunkIndex.GetNearbyChunkIndex((Direction)i);
                            GameObject nearbyChunk = GetChunk(nearbyIndex);
                            if (nearbyChunk == null)
                            {
                                nearbyChunk = Instantiate(ChunkObject, nearbyIndex.ToVector3(), transform.rotation) as GameObject;
                                nearbyChunk.transform.SetParent(Map);
                                nearbyChunk.name = new Vector2(nearbyChunk.transform.position.x, nearbyChunk.transform.position.z).ToString();
                            }
                            currentChunk.NearbyChunks[i] = UIUtility.SafeGetComponent <Chunk>(nearbyChunk.transform);

                            if (stopWatch.Elapsed.TotalSeconds >= FrameDuration)
                            {
                                yield return(new WaitForEndOfFrame());
                            }

                            if (StopSpawning)
                            {
                                EndSequence();
                                yield break;
                            }
                        }
                        if (currentChunk != null)
                        {
                            currentChunk.AddToQueueWhenReady();
                        }
                    }
                }
                if (stopWatch.Elapsed.TotalSeconds >= FrameDuration)
                {
                    yield return(new WaitForEndOfFrame());
                }

                if (StopSpawning)
                {
                    EndSequence();
                    yield break;
                }
            }
            yield return(new WaitForEndOfFrame());

            EndSequence();
        }
示例#5
0
 void Awake()
 {
     subTagCmptList = new List <WareHouseSubTagCmpt>();
     rect           = UIUtility.SafeGetComponent <RectTransform>(transform).rect;
     subToggleGroup = UIUtility.SafeGetComponent <ToggleGroup>(SubTagContent.transform);
 }
 private void Awake()
 {
     lockTrans = UIUtility.FindTransfrom(transform, "Lock");
     empty     = UIUtility.FindTransfrom(transform, "Empty");
     icon      = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Empty/Icon"));
 }
示例#7
0
 public override void Awake()
 {
     selectEffect = UIUtility.SafeGetComponent <CanvasGroup>(SelectTrans);
 }
示例#8
0
 void Awake()
 {
     _anim = UIUtility.SafeGetComponent <Animation>(transform);
     _name = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "BG/Name"));
     _icon = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));
 }
示例#9
0
 public override void Awake()
 {
     materialIcon      = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Icon"));
     materialCountText = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Value"));
     TitleText         = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Title/Text"));
 }
示例#10
0
 public override void Awake()
 {
     _content = UIUtility.SafeGetComponent<Text>(UIUtility.FindTransfrom(transform, "Text"));
     _btn = UIUtility.SafeGetComponent<Button>(transform);
     _anim = UIUtility.SafeGetComponent<Animator>(transform);
 }
示例#11
0
 private void Awake()
 {
     _icon = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BGLine/Icon"));
     _text = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "BGLine/Name"));
     _btn  = UIUtility.SafeGetComponent <Button>(transform);
 }