Beispiel #1
0
    public static void LoadNodes(Quest quest)
    {
        bool hasStartTrigger = false;
        bool hasEndTrigger   = false;

        foreach (QuestTrigger trigger in quest.questTriggers)
        {
            new Node(trigger);

            if (trigger.GetType() == QuestEditor.TranslateType(TRIGGER_TYPES.START))
            {
                hasStartTrigger = true;
            }
            if (trigger.GetType() == QuestEditor.TranslateType(TRIGGER_TYPES.END))
            {
                hasEndTrigger = true;
            }
        }

        if (!hasStartTrigger)
        {
            Debug.Log("no start trigger");
            new Node(quest.gameObject, QuestEditor.TranslateType(TRIGGER_TYPES.START));
        }
        if (!hasEndTrigger)
        {
            Debug.Log("no end trigger");
            new Node(quest.gameObject, QuestEditor.TranslateType(TRIGGER_TYPES.END));
        }
    }
Beispiel #2
0
 private void Awake()
 {
     questEditor         = GetComponent <QuestEditor>();
     questResultManager  = GetComponent <QuestResultManager>();
     resourceManager     = FindObjectOfType <ResourceManager>();
     notificationManager = FindObjectOfType <NotificationManager>();
 }
Beispiel #3
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        QuestEditor editor = (QuestEditor)EditorWindow.GetWindow(typeof(QuestEditor));

        editor.minSize = new Vector2(1500, 600);
        editor.Show();
    }
Beispiel #4
0
        public static void EditQuest(string path)
        {
            ValkyrieDebug.Log("Starting Editor" + Environment.NewLine);

            Destroyer.Destroy();

            Game.Get().audioControl.StopMusic();
            QuestEditor.Begin(path);
        }
Beispiel #5
0
 public void ChangeScript(System.Type type)
 {
     if (type != QuestEditor.TranslateType(TRIGGER_TYPES.START) && type != QuestEditor.TranslateType(TRIGGER_TYPES.END) &&
         trigger.GetType() != QuestEditor.TranslateType(TRIGGER_TYPES.START) && trigger.GetType() != QuestEditor.TranslateType(TRIGGER_TYPES.END))
     {
         QuestEditor.selectedQuest.questTriggers.Remove(trigger);
         QuestTrigger temp = (QuestTrigger)trigger.gameObject.AddComponent(type);
         Object.DestroyImmediate(trigger);
         trigger = temp;
         ChangeTitle(type);
         QuestEditor.selectedQuest.questTriggers.Add(trigger);
     }
 }
Beispiel #6
0
    public static void Create()
    {
        Game game = Game.Get();

        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        // Menu border
        UIElement ui = new UIElement();

        ui.SetLocation((UIScaler.GetWidthUnits() - 12) / 2, 9, 12, 13);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 10, 10, 2);
        ui.SetText(SAVE);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(QuestEditor.Save);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 13, 10, 2);
        ui.SetText(RELOAD);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(delegate { QuestEditor.Reload(game.quest.originalPath); });
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 16, 10, 2);
        ui.SetText(MAIN_MENU);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(GameStateManager.MainMenu);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 19, 10, 2);
        ui.SetText(CommonStringKeys.CANCEL);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(Destroyer.Dialog);
        new UIElementBorder(ui);
    }
 public override void OnGUI(Rect rect)
 {
     if ((gameObject = Selection.activeGameObject) == null)
     {
         gameObject = QuestEditor.selectedQuest.gameObject;
     }
     GUILayout.Label("Créer un noeud (trigger) :", EditorStyles.boldLabel);
     gameObject  = (GameObject)EditorGUILayout.ObjectField("GameObject", gameObject, typeof(GameObject), true);
     triggerType = (TRIGGER_TYPES)EditorGUILayout.EnumPopup("Type du trigger :", triggerType);
     if (GUILayout.Button("Créer le trigger") && gameObject != null)
     {
         new Node(gameObject, QuestEditor.TranslateType(triggerType));
     }
 }
Beispiel #8
0
 private void OnGUI()
 {
     if (GUILayout.Button("Entity Editor"))
     {
         EntityEditor.ShowWindow();
     }
     if (GUILayout.Button("Item Editor"))
     {
         ItemEditor.ShowWindow();
     }
     if (GUILayout.Button("Quest Editor"))
     {
         QuestEditor.ShowWindow();
     }
 }
    // Select a quest for editing
    public void Selection(string key)
    {
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        // Fetch all of the quest data
        Debug.Log("Selecting Quest: " + key + System.Environment.NewLine);
        game.quest = new Quest(questList[key]);
        Debug.Log("Starting Editor" + System.Environment.NewLine);
        QuestEditor.Begin();
    }
    public void Selection(string key)
    {
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        // In the build the content packs need to go into the build data dir, this is currently manual
        string contentLocation = Application.dataPath + "/valkyrie-contentpacks/";

        if (Application.isEditor)
        {
            // If running through unity then we assume you are using the git content, with the project at the same level
            contentLocation = Application.dataPath + "/../../valkyrie-contentpacks/";
        }

        // Fetch content (in future this will need to be selectable
        // Find any content packs at the location
        game.cd = new ContentData(contentLocation);
        // Check if we found anything
        if (game.cd.GetPacks().Count == 0)
        {
            Debug.Log("Error: Failed to find any content packs, please check that you have them present in: " + contentLocation);
        }

        // In the future this is where you select which packs to load, for now we load everything.
        foreach (string pack in game.cd.GetPacks())
        {
            game.cd.LoadContent(pack);
        }

        // Fetch all of the quest data
        game.qd = new QuestData(questList[key]);

        if (game.qd == null)
        {
            Debug.Log("Error: Unable to load quest: " + key);
            Destroyer.MainMenu();
        }
        else
        {
            QuestEditor.Begin();
        }
    }
    // Select a quest for editing
    public void Selection(string key)
    {
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
        {
            Object.Destroy(go);
        }

        game.audioControl.Music(new List <string>());

        // Fetch all of the quest data
        ValkyrieDebug.Log("Selecting Quest: " + key + System.Environment.NewLine);
        game.quest = new Quest(questList[key]);
        ValkyrieDebug.Log("Starting Editor" + System.Environment.NewLine);
        QuestEditor.Begin();
    }
Beispiel #12
0
    public static void Editor()
    {
        Game   game = Game.Get();
        string path = game.quest.questPath;

        Destroyer.Destroy();

        foreach (string pack in game.cd.GetPacks())
        {
            game.cd.LoadContent(pack);
        }

        // Stop music
        game.audioControl.StopMusic();

        ValkyrieDebug.Log("Starting Editor" + System.Environment.NewLine);
        QuestEditor.Begin(path);
    }
Beispiel #13
0
        public static void EditCurrentQuest()
        {
            var game = Game.Get();

            if (!GetCurrentQuestPath(game, out var currentQuestPath))
            {
                // Failsafe. Go to main menu if there's no valid quest loaded
                MainMenu();
                return;
            }

            ValkyrieDebug.Log("Starting Editor" + Environment.NewLine);

            Destroyer.Destroy();

            game.audioControl.StopMusic();
            QuestEditor.Begin(currentQuestPath);
        }
Beispiel #14
0
        public void Test()
        {
            var editor = new QuestEditor();

            editor.SetState(InitializeStates());

            editor.UpdateState(new Block {
                Command = StandardCommands.MeetCharacter
            });
            editor.UpdateState(new Block {
                Command = StandardCommands.OpenDialog
            });
            editor.UpdateState(new Block {
                Command = StandardCommands.DialogOptionThree
            });
            editor.UpdateState(new Block {
                Command = StandardCommands.ToBeContinued
            });
            editor.UpdateState();
        }
Beispiel #15
0
    public static void Editor()
    {
        Game   game = Game.Get();
        string path = game.quest.questPath;

        Destroyer.Destroy();

        game.cd = new ContentData(game.gameType.DataDirectory());
        foreach (string pack in game.cd.GetPacks())
        {
            game.cd.LoadContent(pack);
        }

        // Stop music
        game.audioControl.Music(new List <string>());

        // Fetch all of the quest data
        game.quest = new Quest(new QuestData.Quest(path));
        ValkyrieDebug.Log("Starting Editor" + System.Environment.NewLine);
        QuestEditor.Begin();
    }
Beispiel #16
0
    public static void Create()
    {
        Game game = Game.Get();

        if (GameObject.FindGameObjectWithTag("dialog") != null)
        {
            return;
        }

        // Menu border
        DialogBox db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 12) / 2, 9), new Vector2(12, 13), StringKey.NULL);

        db.AddBorder();
        db.SetFont(game.gameType.GetHeaderFont());

        TextButton tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 10), new Vector2(10, 2f),
            SAVE, delegate { QuestEditor.Save(); }, Color.white);

        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 13), new Vector2(10, 2f),
            RELOAD, delegate { QuestEditor.Reload(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 16), new Vector2(10, 2f),
            MAIN_MENU, delegate { Destroyer.MainMenu(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 19), new Vector2(10, 2f),
            CommonStringKeys.CANCEL, delegate { Destroyer.Dialog(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());
    }
Beispiel #17
0
    // Select a quest for editing
    public void Selection(string key)
    {
        Game game = Game.Get();

        // Remove all current components
        foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
        {
            Object.Destroy(go);
        }

        if (game.quest != null)
        {
            game.quest.RemoveAll();
        }

        game.audioControl.Music(new List <string>());

        // Fetch all of the quest data
        ValkyrieDebug.Log("Selecting Quest: " + key + System.Environment.NewLine);
        ValkyrieDebug.Log("Starting Editor" + System.Environment.NewLine);
        QuestEditor.Begin(questList[key].path);
    }
	public void InitWindows()
	{
		Skin = (GUISkin)Resources.Load("GUI/EditorGUI");
		
		//windows init
		npcEditor = new NPCEditor(Skin, this);

		armorEditor = new ArmorEditor(Skin, this);

		arenaEditor = new ArenaEditor(Skin, this);

		enemyEditor = new EnemyEditor(Skin, this);

		currencyEditor = new CurrencyEditor(Skin, this);
		
		conversationEditor = new ConversationEditor(Skin, this);
		
		shopEditor = new ShopEditor(Skin, this);

		questEditor = new QuestEditor(Skin, this);
		
		itemEditor = new  ItemEditor(Skin, this);

		minigameEditor = new MiniGameEditor(Skin, this);

		serviceEditor = new ServiceEditor(Skin, this);

		npcQuestEditor = new NPCQuestEditor(Skin, this);

		townEditor = new TownEditor(Skin, this);

		badgeEditor = new BadgeEditor(Skin, this);
		
		constructionEditor = new ConstructionEditor(Skin, this);

		loadWindows = false;
	}
Beispiel #19
0
    void DisplayData()
    {
        // Common objects
        if (triggerType != (triggerType = (TRIGGER_TYPES)EditorGUILayout.EnumPopup("Type du trigger :", triggerType)))
        {
            node.ChangeScript(QuestEditor.TranslateType(triggerType));
        }
        if (GUILayout.Button("Changer GameObject"))
        {
            node.ChangeGameObject(Selection.activeGameObject);
        }

        node.trigger.isActive = EditorGUILayout.Toggle("is Active", node.trigger.isActive);
        node.trigger.enabled  = node.trigger.isActive;

        desactiveSelf = EditorGUILayout.Toggle("Desactive Self", desactiveSelf);

        if (desactiveSelf && !node.trigger.triggersToDesactive.Contains(node.trigger))
        {
            node.trigger.triggersToDesactive.Add(node.trigger);
        }
        else if (!desactiveSelf)
        {
            node.trigger.triggersToDesactive.Remove(node.trigger);
        }

        node.trigger.isInteractable = EditorGUILayout.BeginToggleGroup("is Interactable", node.trigger.isInteractable);
        node.trigger.offsetIcon     = EditorGUILayout.Vector2Field("offsetIcon", node.trigger.offsetIcon);
        EditorGUILayout.EndToggleGroup();

        if (node.trigger.tag == "NPC")
        {
            node.trigger.offsetIcon = node.trigger.GetComponent <NPC>().offsetIcon;
        }

        // Specific node.trigger
        if (node.trigger.GetType() == typeof(QuestTrigger_Dialogue) || node.trigger.GetType() == typeof(StartQuest_Dialogue) || node.trigger.GetType() == typeof(EndQuest_Dialogue))
        {
            DisplayDialogue();
        }
        else if (node.trigger.GetType() == typeof(QuestTrigger_ItemPickup))
        {
            ((QuestTrigger_ItemPickup)node.trigger).isQuestItem = EditorGUILayout.Toggle("Is Quest Item ?", ((QuestTrigger_ItemPickup)node.trigger).isQuestItem);
            node.trigger.GetComponent <ItemOnObject>().item     = (Item)EditorGUILayout.ObjectField("Item to pickup", node.trigger.GetComponent <ItemOnObject>().item, typeof(Item), false);
            node.trigger.offsetIcon = node.trigger.GetComponent <ItemOnObject>().item.offsetIcon;

            /*node.trigger.GetComponent<SpriteRenderer>().sprite = node.trigger.GetComponent<ItemOnObject>().item.icon;
             * if (node.trigger.GetComponent<ItemPickup>() != null)
             *  Object.DestroyImmediate(node.trigger.GetComponent<ItemPickup>());*/
        }
        else if (node.trigger.GetType() == typeof(QuestTrigger_Buy))
        {
            DisplayItemsToBuy();
        }
        else if (node.trigger.GetType() == typeof(QuestTrigger_Craft))
        {
            DisplayItemsToCraft();
        }
        else if (node.trigger.GetType() == typeof(RemoveItemAT))
        {
            ((RemoveItemAT)node.trigger).item = (Item)EditorGUILayout.ObjectField("Item to remove", ((RemoveItemAT)node.trigger).item, typeof(Item), false);
        }
        else if (node.trigger.GetType() == typeof(RewardTriggerAT))
        {
            DisplayRewards();
        }
        else if (node.trigger.GetType() == typeof(InstantiateAT))
        {
            ((InstantiateAT)node.trigger).prefab = (GameObject)EditorGUILayout.ObjectField("Prefab to instantiate", ((InstantiateAT)node.trigger).prefab, typeof(GameObject), false);
        }
    }
Beispiel #20
0
    /// <summary>
    /// Create a .valkyrie package and associated meta data
    /// </summary>
    private static void CreatePackage()
    {
        Destroyer.Dialog();
        Game game = Game.Get();

        // save content before creating the package
        QuestEditor.Save();

        string packageName = Path.GetFileName(Path.GetDirectoryName(game.quest.qd.questPath));

        try
        {
            string desktopDir  = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
            string destination = Path.Combine(desktopDir, packageName);
            int    postfix     = 2;
            while (Directory.Exists(destination))
            {
                destination = Path.Combine(desktopDir, packageName + postfix++);
            }
            Directory.CreateDirectory(destination);

            string packageFile = Path.Combine(destination, packageName + ".valkyrie");

            using (var zip = new ZipFile())
            {
                zip.AddDirectory(Path.GetDirectoryName(game.quest.qd.questPath));
                zip.Save(packageFile);
            }

            // Append sha version
            using (FileStream stream = File.OpenRead(packageFile))
            {
                byte[] checksum = SHA256Managed.Create().ComputeHash(stream);
                game.quest.qd.quest.version = System.BitConverter.ToString(checksum);
            }

            string icon = game.quest.qd.quest.image.Replace('\\', '/');
            if (icon.Length > 0)
            {
                string iconName = Path.GetFileName(icon);
                // Temp hack to get ToString to output local file
                game.quest.qd.quest.image = iconName;
                string src  = Path.Combine(Path.GetDirectoryName(game.quest.qd.questPath), icon);
                string dest = Path.Combine(destination, iconName);
                File.Copy(src, dest);
            }
            string manifest = game.quest.qd.quest.ToString();
            // Restore icon
            game.quest.qd.quest.image = icon;

            foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.name"))
            {
                manifest += "name." + kv.Key + "=" + kv.Value + System.Environment.NewLine;
            }

            foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.synopsys"))
            {
                manifest += "synopsys." + kv.Key + "=" + kv.Value.Replace("\n", "").Replace("\r", "") + System.Environment.NewLine;
            }

            foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.description"))
            {
                manifest += "description." + kv.Key + "=" + kv.Value.Replace("\n", "\\n").Replace("\r", "") + System.Environment.NewLine;
            }

            foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.authors"))
            {
                manifest += "authors." + kv.Key + "=" + kv.Value.Replace("\n", "\\n").Replace("\\r", "") + System.Environment.NewLine;
            }

            foreach (KeyValuePair <string, string> kv in LocalizationRead.selectDictionary("qst").ExtractAllMatches("quest.authors_short"))
            {
                manifest += "authors_short." + kv.Key + "=" + kv.Value.Replace("\n", "").Replace("\r", "") + System.Environment.NewLine;
            }

            File.WriteAllText(Path.Combine(destination, packageName + ".ini"), manifest);
        }
        catch (System.IO.IOException e)
        {
            ValkyrieDebug.Log("Warning: Unable to write to valkyrie package." + e.Message);
        }
    }
Beispiel #21
0
    public static void Create()
    {
        if (GameObject.FindGameObjectWithTag("dialog") != null)
        {
            return;
        }

        DialogBox db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 12) / 2, 9), new Vector2(12, 13), "");

        db.AddBorder();

        TextButton tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 10), new Vector2(10, 2f), "Save", delegate { QuestEditor.Save(); }, Color.white);

        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);

        tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 13), new Vector2(10, 2f), "Reload", delegate { QuestEditor.Reload(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);

        tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 16), new Vector2(10, 2f), "Main Menu", delegate { Destroyer.MainMenu(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);

        tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 19), new Vector2(10, 2f), "Cancel", delegate { Destroyer.Dialog(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
    }
Beispiel #22
0
    static void Init()
    {
        QuestEditor window = (QuestEditor)EditorWindow.GetWindow(typeof(QuestEditor));

        window.Show();
    }
Beispiel #23
0
    public void Test()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        QuestEditor.Save();

        Game   game = Game.Get();
        string path = game.quest.questPath;

        Destroyer.Destroy();

        game.cd = new ContentData(game.gameType.DataDirectory());
        foreach (string pack in game.cd.GetPacks())
        {
            game.cd.LoadContent(pack);
        }

        game.testMode = true;
        // Fetch all of the quest data and initialise the quest
        game.quest = new Quest(new QuestData.Quest(path));
        game.heroCanvas.SetupUI();

        int heroCount = Random.Range(game.quest.qd.quest.minHero, game.quest.qd.quest.maxHero + 1);

        List <HeroData> hOptions = new List <HeroData>(game.cd.heroes.Values);

        for (int i = 0; i < heroCount; i++)
        {
            game.quest.heroes[i].heroData = hOptions[Random.Range(0, hOptions.Count)];
            hOptions.Remove(game.quest.heroes[i].heroData);
        }

        // Starting morale is number of heros
        game.quest.vars.SetValue("$%morale", heroCount);
        // Set quest flag based on hero count
        game.quest.vars.SetValue("#heroes", heroCount);
        game.quest.heroesSelected = true;

        // Clear off heros if not required
        if (!game.gameType.DisplayHeroes())
        {
            game.heroCanvas.Clean();
        }
        else
        {
            game.heroCanvas.UpdateImages();
            game.heroCanvas.UpdateStatus();
        }

        // Draw morale if required
        if (game.gameType is D2EGameType)
        {
            new ClassSelectionScreen();
        }
        else
        {
            new InvestigatorItems();
        }
    }
Beispiel #24
0
    private void ChangeTitle(System.Type type)
    {
        title = "";

        if (QuestEditor.selectedNode == id)
        {
            title += "* ";
        }

        if (type == QuestEditor.TranslateType(TRIGGER_TYPES.DIALOGUE))
        {
            title += "Dialogue";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.ITEM_PICKUP))
        {
            title += "Item Pickup";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.BUY))
        {
            title += "Buy";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.CRAFT))
        {
            title += "Craft";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.START))
        {
            title += "Start Dialogue";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.END))
        {
            title += "End Dialogue";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.ZONE))
        {
            title += "Zone";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.AT_REMOVE_ITEM))
        {
            title += "Remove Item (AT)";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.AT_REWARD))
        {
            title += "Reward (AT)";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.AT_END_QUEST))
        {
            title += "End Quest (AT)";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.AT_INSTANTIATE))
        {
            title += "Instantiate (AT)";
        }
        else if (type == QuestEditor.TranslateType(TRIGGER_TYPES.AT_ACTIVE_ENNEMI))
        {
            title += "Active Ennemi (AT)";
        }
        else
        {
            title = "Trigger";
        }

        if (QuestEditor.selectedNode == id)
        {
            title += " *";
        }
    }
Beispiel #25
0
    public void Test()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        QuestEditor.Save();

        Game   game = Game.Get();
        string path = game.quest.questPath;

        Destroyer.Destroy();

        // All content data has been loaded by editor, cleanup everything
        game.cd = new ContentData(game.gameType.DataDirectory());
        // Load the base content
        game.ContentLoader.LoadContentID("");
        // Load current configuration
        Dictionary <string, string> packs = game.config.data.Get(game.gameType.TypeName() + "Packs");

        if (packs != null)
        {
            foreach (KeyValuePair <string, string> kv in packs)
            {
                game.ContentLoader.LoadContentID(kv.Key);
            }
        }

        game.testMode = true;
        // Fetch all of the quest data and initialise the quest
        game.quest = new Quest(new QuestData.Quest(path));
        game.heroCanvas.SetupUI();

        int heroCount = Random.Range(game.quest.qd.quest.minHero, game.quest.qd.quest.maxHero + 1);

        List <HeroData> hOptions = new List <HeroData>(game.cd.Values <HeroData>());

        for (int i = 0; i < heroCount; i++)
        {
            game.quest.heroes[i].heroData = hOptions[Random.Range(0, hOptions.Count)];
            game.quest.vars.SetValue("#" + game.quest.heroes[i].heroData.sectionName, 1);
            hOptions.Remove(game.quest.heroes[i].heroData);
        }

        // Starting morale is number of heros
        game.quest.vars.SetValue("$%morale", heroCount);
        // Set quest flag based on hero count
        game.quest.vars.SetValue("#heroes", heroCount);
        game.quest.heroesSelected = true;

        // Clear off heros if not required
        if (!game.gameType.DisplayHeroes())
        {
            game.heroCanvas.Clean();
        }
        else
        {
            game.heroCanvas.UpdateImages();
            game.heroCanvas.UpdateStatus();
        }

        // Draw morale if required
        if (game.gameType is D2EGameType)
        {
            new ClassSelectionScreen();
        }
        else
        {
            new InvestigatorItems();
        }
    }