Пример #1
0
        private static void UpdateObjectHierarchyList()
        {
            List <UnitCreep> creepList = EditorDBManager.GetCreepList();

            if (creepList.Count == 0 || selectID >= creepList.Count)
            {
                return;
            }
            EditorUtilities.GetObjectHierarchyList(creepList[selectID].gameObject, SetObjListCallback);
        }
Пример #2
0
        public void Select(string name)
        {
            int selectID = 0;
            List <UnitCreep> creepList = EditorDBManager.GetCreepList();

            for (int i = 0; i < creepList.Count; i++)
            {
                if (creepList[i].unitName.Trim().Equals(name.Trim()))
                {
                    selectID = i;
                }
            }
            SelectCreep(selectID);
        }
Пример #3
0
        void OnGUI()
        {
            if (window == null)
            {
                Init();
            }

            List <UnitCreep> creepList = EditorDBManager.GetCreepList();

            if (GUI.Button(new Rect(window.position.width - 120, 5, 100, 25), "Save"))
            {
                EditorDBManager.SetDirtyCreep();
            }

            EditorGUI.LabelField(new Rect(5, 7, 150, 17), "Add new creep:");
            UnitCreep newCreep = null;

            newCreep = (UnitCreep)EditorGUI.ObjectField(new Rect(100, 7, 140, 17), newCreep, typeof(UnitCreep), false);
            if (newCreep != null)
            {
                int newSelectID = EditorDBManager.AddNewCreep(newCreep);
                if (newSelectID != -1)
                {
                    SelectCreep(newSelectID);
                }
            }


            float startX = 5;
            float startY = 50; float cachedY = 50;

            if (minimiseList)
            {
                if (GUI.Button(new Rect(startX, startY - 20, 30, 18), ">>"))
                {
                    minimiseList = false;
                }
            }
            else
            {
                if (GUI.Button(new Rect(startX, startY - 20, 30, 18), "<<"))
                {
                    minimiseList = true;
                }
            }
            Vector2 v2 = DrawUnitList(startX, startY, creepList); startX = v2.x + 25;

            if (creepList.Count == 0)
            {
                return;
            }

            cont = new GUIContent("Creep Prefab:", "The prefab object of the creep\nClick this to highlight it in the ProjectTab");
            EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
            EditorGUI.ObjectField(new Rect(startX + 90, startY, 185, height), creepList[selectID].gameObject, typeof(GameObject), false);
            startY += spaceY + 10;


            Rect visibleRect = new Rect(startX, startY, window.position.width - startX - 10, window.position.height - startY - 5);
            Rect contentRect = new Rect(startX, startY, contentWidth, contentHeight);

            //~ GUI.color=new Color(.8f, .8f, .8f, 1f);
            //~ GUI.Box(visibleRect, "");
            //~ GUI.color=Color.white;

            scrollPos2 = GUI.BeginScrollView(visibleRect, scrollPos2, contentRect);

            UnitCreep creep = creepList[selectID];

            v3            = DrawUnitConfigurator(startX, startY, creepList, creep.type == _CreepType.Offense);
            contentWidth  = v3.z;
            contentHeight = v3.y;

            startX += spaceX + width + 45;
            startY += 75;

            if (creep.type != _CreepType.Default)
            {
                for (int i = 0; i < creep.stats.Count; i++)
                {
                    v3 = DrawStat(creep.stats[i], startX, startY, statContentHeight, creepList[selectID]);
                    statContentHeight = v3.z;
                    if (contentHeight < v3.y)
                    {
                        contentHeight = v3.y;
                    }
                    //if (contentWidth < 580)
                    contentWidth = 580;

                    startY += 435;
                }
            }

            contentHeight -= cachedY;

            GUI.EndScrollView();


            if (GUI.changed)
            {
                EditorDBManager.SetDirtyCreep();
            }
        }