Exemple #1
0
 protected override void ShiftItemDown()
 {
     if (selectID < EffectDB.GetList().Count - 1)
     {
         ShiftItem(1);
     }
 }
Exemple #2
0
        private void ShiftItem(int dir)
        {
            Effect item = EffectDB.GetList()[selectID];

            EffectDB.GetList()[selectID]       = EffectDB.GetList()[selectID + dir];
            EffectDB.GetList()[selectID + dir] = item;
            selectID += dir;
        }
Exemple #3
0
 private void SelectItem(int newID)
 {
     selectID = newID;
     if (EffectDB.GetList().Count <= 0)
     {
         return;
     }
     selectID = Mathf.Clamp(selectID, 0, EffectDB.GetList().Count - 1);
 }
Exemple #4
0
        private int _NewItem(int idx = -1)
        {
            Effect item = null;

            if (idx < 0)
            {
                item = new Effect(); item.Reset();
            }
            if (idx >= 0)
            {
                item = EffectDB.GetList()[idx].Clone();
            }

            item.prefabID = TDE.GenerateNewID(EffectDB.GetPrefabIDList());

            EffectDB.GetList().Add(item);
            EffectDB.UpdateLabel();

            return(EffectDB.GetList().Count - 1);
        }
Exemple #5
0
        public void OnGUI()
        {
            TDE.InitGUIStyle();

            if (!CheckIsPlaying())
            {
                return;
            }
            if (window == null)
            {
                Init();
            }


            List <Effect> abilityList = EffectDB.GetList();

            Undo.RecordObject(this, "window");
            Undo.RecordObject(EffectDB.GetDB(), "abilityDB");


            if (GUI.Button(new Rect(Math.Max(260, window.position.width - 120), 5, 100, 25), "Save"))
            {
                TDE.SetDirty();
            }


            if (GUI.Button(new Rect(5, 5, 120, 25), "Create New"))
            {
                Select(NewItem());
            }
            if (abilityList.Count > 0 && GUI.Button(new Rect(130, 5, 100, 25), "Clone Selected"))
            {
                Select(NewItem(selectID));
            }


            float startX = 5; float startY = 55;

            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 = DrawEffectList(startX, startY, abilityList);

            startX = v2.x + 25;

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


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

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

            v2            = DrawEffectConfigurator(startX, startY, abilityList[selectID]);
            contentWidth  = v2.x - startX;
            contentHeight = v2.y - 55;

            GUI.EndScrollView();


            if (GUI.changed)
            {
                TDE.SetDirty();
            }
        }
Exemple #6
0
 protected override void DeleteItem()
 {
     EffectDB.GetList().RemoveAt(deleteID);
     EffectDB.UpdateLabel();
 }