// Add menu named "TowerEditor" to the Window menu
    //[MenuItem ("TDTK/DamageArmorTable")]
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window = (DamageArmorTableEditor)EditorWindow.GetWindow(typeof (DamageArmorTableEditor));
        //~ window.minSize=new Vector2(340, 170);
        window.minSize=new Vector2(470, 300);
        //~ window.maxSize=new Vector2(471, 301);

        LoadPrefab();
    }
Example #2
0
 void DeleteDmg(bool flag)
 {
     if (flag)
     {
         DamageArmorTableEditor.DeleteDmg(dmgType);
         this.Close();
     }
     else
     {
     }
 }
    // Add menu named "TowerEditor" to the Window menu
    //[MenuItem ("TDTK/DamageArmorTable")]
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window = (DamageArmorTableEditor)EditorWindow.GetWindow(typeof(DamageArmorTableEditor));
        //~ window.minSize=new Vector2(340, 170);
        window.minSize = new Vector2(470, 300);
        //~ window.maxSize=new Vector2(471, 301);


        LoadPrefab();
    }
Example #4
0
    void OnGUI()
    {
        if (window == null)
        {
            Init(lastPos);
        }

        int startX = 5;
        int startY = 5;
        int height = 20;

        if (dmgType != null)
        {
            GUI.skin.textField.alignment = TextAnchor.UpperLeft;
            EditorGUI.LabelField(new Rect(startX, startY, 150, height), "Damage Type: ");
            dmgType.name = EditorGUI.TextArea(new Rect(startX, startY += 17, 290, height), dmgType.name);

            EditorGUI.LabelField(new Rect(startX, startY += 25, 150, height), "Description: ");
            dmgType.desp = EditorGUI.TextArea(new Rect(startX, startY += 17, 290, 50), dmgType.desp);

            startY += 60;

            if (newDmg)
            {
                if (GUI.Button(new Rect(window.position.width - 75, startY, 70, 20), "Confirm"))
                {
                    DamageArmorTableEditor.NewDmg(dmgType);
                    this.Close();
                }
            }
            else
            {
                if (GUI.Button(new Rect(window.position.width / 2 - 35, startY, 70, 20), "OK"))
                {
                    DamageArmorTableEditor.EditDmg(dmgType);
                    this.Close();
                }
                if (GUI.Button(new Rect(window.position.width - 75, startY, 70, 20), "Delete"))
                {
                    Vector2 pos = new Vector2(window.position.x, window.position.y);
                    pos += Event.current.mousePosition;
                    ConfirmationWindow.InitWindow("Are you sure?", this.DeleteDmg, pos);
                }
            }
        }

        if (GUI.Button(new Rect(startX, startY, 70, 20), "Cancel"))
        {
            //~ target.OnFocus();
            //DamageArmorTableEditor.Test();
            this.Close();
        }
    }
    // Add menu named "TowerEditor" to the Window menu
    //[MenuItem ("TDTK/DamageArmorTable")]
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window         = (DamageArmorTableEditor)EditorWindow.GetWindow(typeof(DamageArmorTableEditor));
        window.minSize = new Vector2(340, 170);

        armorTypes = new List <ArmorType>();

        dmgTypes = new List <DamageType>();

        Load();
    }
Example #6
0
 public static void OpenDamageTable()
 {
     DamageArmorTableEditor.Init();
 }
    void EffectAttrConfigurator(UnitAbility uAB, int ID, int startX, int startY)
    {
        EffectAttr effectAttr = uAB.effectAttrs[ID];

        if (GUI.Button(new Rect(startX, startY += 18, 70, 14), "Remove"))
        {
            uAB.effectAttrs.Remove(effectAttr);
            return;
        }

        int type = (int)effectAttr.type;

        cont     = new GUIContent("Type:", "Type of the effect.");
        contList = new GUIContent[effectAttrTypeLabel.Length];
        for (int i = 0; i < contList.Length; i++)
        {
            contList[i] = new GUIContent(effectAttrTypeLabel[i], effectAttrTypeTooltip[i]);
        }
        EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
        type            = EditorGUI.Popup(new Rect(startX + 40, startY, 80, 16), type, contList);
        effectAttr.type = (_EffectAttrType)type;



        if (effectAttr.type == _EffectAttrType.Teleport)
        {
            uAB.targetType             = _AbilityTargetType.EmptyTile;
            uAB.requireTargetSelection = true;
            uAB.targetArea             = _TargetArea.Default;
            uAB.aoeRange = 0;
        }
        else if (effectAttr.type == _EffectAttrType.SpawnUnit || effectAttr.type == _EffectAttrType.SpawnCollectible)
        {
            if (effectAttr.type == _EffectAttrType.SpawnUnit)
            {
                cont = new GUIContent("Unit To Spawn:", "The unit prefab to be used spawned");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 180, 20), cont);
                effectAttr.unit = (UnitTB)EditorGUI.ObjectField(new Rect(startX, startY += 18, 125, 17), effectAttr.unit, typeof(UnitTB), false);

                cont = new GUIContent("Duration:", "The effective duration in which the spawned unit will last\nSet to -ve value for the spawn to be permenant");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
                effectAttr.duration = EditorGUI.IntField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.duration);

                if (effectAttr.duration == 0)
                {
                    effectAttr.duration = -1;
                }
            }
            else if (effectAttr.type == _EffectAttrType.SpawnCollectible)
            {
                cont = new GUIContent("Collectible To Spawn:", "The collectible prefab to be used spawned");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 180, 20), cont);
                effectAttr.collectible = (CollectibleTB)EditorGUI.ObjectField(new Rect(startX, startY += 18, 125, 17), effectAttr.collectible, typeof(CollectibleTB), false);
            }


            uAB.targetType             = _AbilityTargetType.EmptyTile;
            uAB.requireTargetSelection = true;
            uAB.targetArea             = _TargetArea.Default;
            uAB.aoeRange = 0;
        }
        else if (effectAttr.type == _EffectAttrType.ChangeTargetFaction)
        {
            cont = new GUIContent("Chance:", "The chance of success. Take value from 0 to 1");
            EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
            effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value);

            //~ cont=new GUIContent("Duration:", "The effective duration of the faction change");
            //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont);
            //~ effectAttr.duration=EditorGUI.IntField(new Rect(startX+70, startY-1, 50, 16), effectAttr.duration);

            uAB.targetType             = _AbilityTargetType.Hostile;
            uAB.requireTargetSelection = true;
            uAB.targetArea             = _TargetArea.Default;
            uAB.aoeRange = 0;
        }
        else if (effectAttr.type == _EffectAttrType.HPDamage)
        {
            cont = new GUIContent("UseDefaultValue:", "Check to use the unit default attack damage value");
            EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
            effectAttr.useDefaultDamageValue              = EditorGUI.Toggle(new Rect(startX + 107, startY - 1, 50, 16), effectAttr.useDefaultDamageValue);
            if (!effectAttr.useDefaultDamageValue)
            {
                cont = new GUIContent("ValueMin:", "Minimum value for the effect");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
                effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value);

                cont = new GUIContent("ValueMax:", "Maximum value for the effect");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
                effectAttr.valueAlt = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.valueAlt);
            }
        }
        else if (effectAttr.type == _EffectAttrType.HPGain || effectAttr.type == _EffectAttrType.APGain || effectAttr.type == _EffectAttrType.APDamage)
        {
            cont = new GUIContent("ValueMin:", "Minimum value for the effect");
            EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
            effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value);

            effectAttr.value = Mathf.Min(effectAttr.value, effectAttr.valueAlt);

            cont = new GUIContent("ValueMax:", "Maximum value for the effect");
            EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
            effectAttr.valueAlt = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.valueAlt);

            effectAttr.valueAlt = Mathf.Max(effectAttr.value, effectAttr.valueAlt);
        }
        else
        {
            cont = new GUIContent("Value:", "Value for the effect");
            EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
            effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value);
        }

        //~ if(type==1){
        //~ cont=new GUIContent("Range:", "Effective range of the ability in term of tile");
        //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), "use Default Damage:");
        //~ effect.useDefaultDamageValue=EditorGUI.Toggle(new Rect(startX+120, startY-1, 50, 16), effect.useDefaultDamageValue);
        //~ }

        //~ if(type!=2 || !effectAttr.useDefaultDamageValue){
        //~ cont=new GUIContent("Range:", "Effective range of the ability in term of tile");
        //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), "value:");
        //~ effectAttr.value=EditorGUI.FloatField(new Rect(startX+70, startY-1, 50, 16), effectAttr.value);
        //~ }


        if (uAB.effectType == _EffectType.Debuff || uAB.effectType == _EffectType.Buff)
        {
            if (effectAttr.type != _EffectAttrType.SpawnUnit)
            {
                cont = new GUIContent("Duration:", "Effective duration of the effect in term of round");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
                effectAttr.duration = EditorGUI.IntField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.duration);
            }
        }


        //~ int type=(int)effectAttr.type;
        //~ cont=new GUIContent("Type:", "Type of the effect");
        //~ contList=new GUIContent[effectAttrTypeLabel.Length];
        //~ for(int i=0; i<contList.Length; i++) contList[i]=new GUIContent(effectAttrTypeLabel[i], effectAttrTypeTooltip[i]);
        //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont);
        //~ type = EditorGUI.Popup(new Rect(startX+40, startY, 80, 16), type, contList);
        //~ effectAttr.type=(_EffectAttrType)type;

        if (effectAttr.type == _EffectAttrType.HPDamage)
        {
            if (damageList.Length > 0)
            {
                contList = new GUIContent[damageTooltipList.Length];
                for (int i = 0; i < contList.Length; i++)
                {
                    contList[i] = new GUIContent(damageList[i], damageTooltipList[i]);
                }
                cont = new GUIContent("Type:", "Damage type to be inflicted on target");

                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);
                effectAttr.damageType = EditorGUI.Popup(new Rect(startX + 40, startY, 80, 16), effectAttr.damageType, contList);
            }
            else
            {
                cont = new GUIContent("Type:", "No damage type has been created, use DamageArmorTableEditor to create one");
                EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont);

                if (GUI.Button(new Rect(startX + 40, startY, 80, 15), "OpenEditor"))
                {
                    DamageArmorTableEditor.Init();
                }
            }
        }
    }
Example #8
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        window = (DamageArmorTableEditor)EditorWindow.GetWindow(typeof (DamageArmorTableEditor));
        window.minSize=new Vector2(340, 170);

        armorNumber=1;
        armorTypes=new List<ArmorType>();
        armorTypes.Add(new ArmorType());

        dmgTypes=new List<DamageType>();

        Load();
    }