Ejemplo n.º 1
0
    public void SetValue(VarOperation op)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectSetValue(op, s); }, new StringKey("val", "SELECT", VALUE));

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" });
        select.AddItem("{" + CommonStringKeys.NUMBER.Translate() + "}", "{NUMBER}", traits);

        AddQuestVars(select);

        traits = new Dictionary <string, IEnumerable <string> >();
        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "#" });

        select.AddItem("#monsters", traits);
        select.AddItem("#heroes", traits);
        select.AddItem("#round", traits);
        select.AddItem("#eliminated", traits);
        foreach (ContentData.ContentPack pack in Game.Get().cd.allPacks)
        {
            if (pack.id.Length > 0)
            {
                select.AddItem("#" + pack.id, traits);
            }
        }
        select.Draw();
    }
Ejemplo n.º 2
0
    public void AddEvent(int index, int button, bool replace = false)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectAddEvent(index, button, replace, s); }, new StringKey("val", "SELECT", CommonStringKeys.EVENT));

        select.AddNewComponentItem("Event");
        select.AddNewComponentItem("Spawn");
        if (game.gameType is MoMGameType)
        {
            select.AddNewComponentItem("Puzzle");
        }

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.Event)
            {
                select.AddItem(kv.Value);
            }
        }

        select.Draw();
    }
Ejemplo n.º 3
0
    public void MonsterTypeReplace(int pos)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectMonsterType(s, pos, true); }, new StringKey("val", "SELECT", CommonStringKeys.MONSTER));

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.CustomMonster)
            {
                select.AddItem(kv.Value);
            }
            if (kv.Value is QuestData.Spawn)
            {
                select.AddItem(kv.Value);
            }
        }

        foreach (KeyValuePair <string, MonsterData> kv in game.cd.monsters)
        {
            select.AddItem(kv.Value);
        }
        select.ExcludeExpansions();
        select.Draw();
    }
    public void AddActivation(int index = -1)
    {
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectAddActivation(index, s); }, new StringKey("val", "SELECT", CommonStringKeys.ACTIVATION));

        select.AddNewComponentItem("Activation");
        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in Game.Get().quest.qd.components)
        {
            if (kv.Value is QuestData.Activation)
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 5
0
    // This is called by game
    public void RightClick()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        PointerEventData pointer = new PointerEventData(EventSystem.current);

        pointer.position = Input.mousePosition;

        List <RaycastResult> raycastResults = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointer, raycastResults);

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

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectComponent, CommonStringKeys.SELECT_ITEM);

        int    count = 0;
        string last  = "";

        foreach (RaycastResult hit in raycastResults)
        {
            foreach (KeyValuePair <string, Quest.BoardComponent> kv in Game.Get().quest.boardItems)
            {
                if (kv.Value.unityObject == hit.gameObject)
                {
                    if (kv.Key.IndexOf("UI") != 0)
                    {
                        last = kv.Key;
                        count++;
                        select.AddItem(Game.Get().quest.qd.components[kv.Key]);
                    }
                    break;
                }
            }
        }
        if (count == 1)
        {
            SelectComponent(last);
        }
        if (count > 1)
        {
            select.Draw();
        }
    }
    public void SetActivation()
    {
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectSetActivation, new StringKey("val", "SELECT", CommonStringKeys.ACTIVATION));

        select.AddItem("{NONE}", "");
        select.AddNewComponentItem("Event");
        foreach (QuestData.QuestComponent c in Game.Get().quest.qd.components.Values)
        {
            if (c.typeDynamic.IndexOf("Event") == 0)
            {
                select.AddItem(c);
            }
        }
        select.Draw();
    }
    public void SetHorrorEvent()
    {
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectSetHorror, new StringKey("val", "SELECT", new StringKey("val", "horror")));

        select.AddItem("{NONE}", "");
        select.AddNewComponentItem("Event");
        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in Game.Get().quest.qd.components)
        {
            if (kv.Value.typeDynamic.Equals("Event"))
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 8
0
    // Open component selection top level
    // Menu for selection of all component types, includes delete options
    public static void TypeSelect(string type = "")
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectComponent, CommonStringKeys.SELECT_ITEM);

        select.AddNewComponentItem("Tile");
        select.AddNewComponentItem("Token");
        select.AddNewComponentItem("Spawn");
        select.AddNewComponentItem("Event");
        select.AddNewComponentItem("CustomMonster");
        select.AddNewComponentItem("UI");
        select.AddNewComponentItem("QItem");
        if (game.gameType is D2EGameType || game.gameType is IAGameType)
        {
            select.AddNewComponentItem("Activation");
            select.AddNewComponentItem("Door");
            select.AddNewComponentItem("MPlace");
        }
        else
        {
            select.AddNewComponentItem("Puzzle");
        }

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(new StringKey("val", "TYPE").Translate(), new string[] { "Quest" });
        select.AddItem(CommonStringKeys.QUEST.Translate(), "Quest", traits);

        foreach (QuestData.QuestComponent c in game.quest.qd.components.Values)
        {
            if (!(c is PerilData))
            {
                select.AddItem(c);
            }
        }

        select.Draw();
        if (type.Length > 0)
        {
            select.SelectTrait(new StringKey("val", "TYPE").Translate(), new StringKey("val", type.ToUpper()).Translate());
        }
    }
    public void SetBase()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectSetBase, new StringKey("val", "SELECT", CommonStringKeys.MONSTER));

        select.AddItem(CommonStringKeys.NONE.Translate(), "{NONE}");

        foreach (KeyValuePair <string, MonsterData> kv in game.cd.monsters)
        {
            select.AddItem(kv.Value);
        }
        select.Draw();
    }
Ejemplo n.º 10
0
    public void SetQuotaVar()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectQuotaVar, new StringKey("val", "SELECT", VAR));

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" });
        select.AddItem("{" + CommonStringKeys.NEW.Translate() + "}", "{NEW}", traits);

        AddQuestVars(select);

        select.Draw();
    }
    public void SetBase()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectSetBase, new StringKey("val", "SELECT", CommonStringKeys.MONSTER));

        select.AddItem(CommonStringKeys.NONE.Translate(), "{NONE}", true);

        foreach (MonsterData monster in game.cd.Values <MonsterData>())
        {
            select.AddItem(monster);
        }
        select.ExcludeExpansions();
        select.Draw();
    }
Ejemplo n.º 12
0
    public void AddVisibility(bool add, int index = -1)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectAddVisibility(add, index, s); }, new StringKey("val", "SELECT", new StringKey("val", "COMPONENT")));

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Special" });

        select.AddItem("#boardcomponents", traits);
        select.AddItem("#monsters", traits);
        select.AddItem("#shop", traits);

        if (game.gameType is D2EGameType || game.gameType is IAGameType)
        {
            select.AddNewComponentItem("Door");
        }
        select.AddNewComponentItem("Tile");
        select.AddNewComponentItem("Token");
        select.AddNewComponentItem("UI");
        select.AddNewComponentItem("QItem");

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.Door || kv.Value is QuestData.Tile || kv.Value is QuestData.Token || kv.Value is QuestData.UI)
            {
                select.AddItem(kv.Value);
            }
            if (kv.Value is QuestData.Spawn)
            {
                select.AddItem(kv.Value);
            }
            if (kv.Value is QuestData.QItem)
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 13
0
    public void SetItem(int index)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { SelectAddItem(index, s); }, CommonStringKeys.SELECT_ITEM);

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.SOURCE.Translate(), new string[] { "Quest" });

        HashSet <string> usedItems = new HashSet <string>();

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            QuestData.QItem i = kv.Value as QuestData.QItem;
            if (i != null)
            {
                select.AddItem(i.sectionName, traits);
                if (i.traits.Length == 0 && i.traitpool.Length == 0)
                {
                    usedItems.Add(i.itemName[0]);
                }
            }
        }

        foreach (KeyValuePair <string, ItemData> kv in game.cd.GetAll <ItemData>())
        {
            if (usedItems.Contains(kv.Key))
            {
                select.AddItem(kv.Value, Color.grey);
            }
            else
            {
                select.AddItem(kv.Value);
            }
        }
        select.ExcludeExpansions();
        select.Draw();
    }
Ejemplo n.º 14
0
    public void AddAssignOp()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s)
        {
            EditorComponentVarTestsUtil.SelectAddOp(s, component, () => Update(), false);
        }, CommonStringKeys.SELECT_VAR);
        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" });
        select.AddItem("{" + CommonStringKeys.NEW.Translate() + "}", "{NEW}", traits, true);

        EditorComponentVarTestsUtil.AddQuestVars(select);

        select.Draw();
    }
Ejemplo n.º 15
0
    public void MonsterPlaceAdd(int heroes, int slot = -1)
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(delegate(string s) { MonsterPlaceAddSelection(heroes, slot, s); }, CommonStringKeys.SELECT_ITEM);

        select.AddNewComponentItem("MPlace");

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.MPlace)
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 16
0
    public void SetHighlight()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectEventHighlight, new StringKey("val", "SELECT", CommonStringKeys.EVENT));

        select.AddItem("{NONE}", "", true);

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.Event)
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 17
0
    public void PickInpsect()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectInspectEvent, new StringKey("val", "SELECT", CommonStringKeys.SELECT_ITEM));

        select.AddItem("{NONE}", "");

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value.typeDynamic.Equals("Event"))
            {
                select.AddItem(kv.Value);
            }
        }
        select.Draw();
    }
Ejemplo n.º 18
0
    public void SetTrigger()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();

        UIWindowSelectionListTraits select = new UIWindowSelectionListTraits(SelectEventTrigger, new StringKey("val", "SELECT", CommonStringKeys.TRIGGER));


        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { new StringKey("val", "GENERAL").Translate() });
        select.AddItem("{NONE}", "", traits);

        bool startPresent = false;
        bool noMorale     = false;
        bool eliminated   = false;

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            QuestData.Event e = kv.Value as QuestData.Event;
            if (e != null)
            {
                if (e.trigger.Equals("EventStart"))
                {
                    startPresent = true;
                }
                if (e.trigger.Equals("NoMorale"))
                {
                    noMorale = true;
                }
                if (e.trigger.Equals("Eliminated"))
                {
                    eliminated = true;
                }
            }
        }

        if (startPresent)
        {
            select.AddItem("EventStart", traits, Color.gray);
        }
        else
        {
            select.AddItem("EventStart", traits);
        }

        if (noMorale)
        {
            select.AddItem("NoMorale", traits, Color.gray);
        }
        else
        {
            select.AddItem("NoMorale", traits);
        }

        if (eliminated)
        {
            select.AddItem("Eliminated", traits, Color.gray);
        }
        else
        {
            select.AddItem("Eliminated", traits);
        }

        select.AddItem("Mythos", traits);
        select.AddItem("EndRound", traits);
        select.AddItem("StartRound", traits);

        traits = new Dictionary <string, IEnumerable <string> >();
        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { CommonStringKeys.MONSTER.Translate() });

        foreach (KeyValuePair <string, MonsterData> kv in game.cd.monsters)
        {
            select.AddItem("Defeated" + kv.Key, traits);
            select.AddItem("DefeatedUnique" + kv.Key, traits);
        }

        HashSet <string> vars = new HashSet <string>();

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            if (kv.Value is QuestData.CustomMonster)
            {
                select.AddItem("Defeated" + kv.Key, traits);
                select.AddItem("DefeatedUnique" + kv.Key, traits);
            }


            if (kv.Value is QuestData.Event)
            {
                QuestData.Event e = kv.Value as QuestData.Event;
                foreach (string s in ExtractVarsFromEvent(e))
                {
                    if (s[0] == '@')
                    {
                        vars.Add(s);
                    }
                }
            }
        }

        traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { new StringKey("val", "VARS").Translate() });

        foreach (string s in vars)
        {
            select.AddItem("Var" + s.Substring(1), traits);
        }

        select.Draw();
    }