// Change the dialog to a delete dialog
    public void Delete()
    {
        questList = QuestLoader.GetUserUnpackedQuests();
        Game game = Game.Get();

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

        // Header
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName() + " To Delete");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        // List of quests
        // FIXME: requires paging
        TextButton tb;
        int        offset = 5;

        foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
        {
            string key = q.Key;
            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Delete(key); }, Color.red, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
            offset += 2;
        }
        // Back to edit list
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { CancelDelete(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Beispiel #2
0
        private int stageNumFile;                            //ステージのファイル番号

        /// <summary>
        /// シーンの間にゲーム情報を伝える仲介者
        /// </summary>
        /// <param name="gameDevice">ゲームディバイス</param>
        public GameManager(GameDevice gameDevice)
        {
            this.gameDevice = gameDevice;
            mapInstance     = null;

            stageManager        = new StageManager(gameDevice);
            enemySettingManager = new EnemySettingManager(gameDevice);
            blockStyle          = new BlockStyle();
            questManager        = new QuestLoader();
            questManager.Initialize();
            questManager.Load(dungeonProcess, true);
            itemManager    = new ItemManager();
            dungeonProcess = new DungeonProcess();
            enemyName      = new EnemyNameLoader();

            #region Player初期化
            PlayerStatusLoader psLoader = new PlayerStatusLoader();
            int[]  status        = psLoader.LoadStatus();
            Status defaultStatus = new Status(1, status[0], status[1], status[2], status[3], 1);
            playerStatus = new PlayerStatus(defaultStatus, gameDevice);
            playerStatus.Initialize();

            playerItem      = playerStatus.GetInventory();                //道具欄を取得
            playerQuest     = new PlayerQuest();
            playerGuildRank = new PlayerGuildRank();
            #endregion

            Load();
        }
    public void Copy()
    {
        questList = QuestLoader.GetQuests();

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

        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select Quest To Copy");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();

        int offset = 5;

        foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
        {
            string     key = q.Key;
            TextButton tb  = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Copy(key); }, Color.white, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
            offset += 2;
        }

        new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { CancelCopy(); }, Color.red);
    }
    public QuestEditSelection()
    {
        // For now only edit unpacked quests
        questList = QuestLoader.GetUserUnpackedQuests();
        //questList = QuestLoader.GetUserQuests();

        // If a dialog window is open we force it closed (this shouldn't happen)
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select Quest");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();

        int offset = 5;

        foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
        {
            string     key = q.Key;
            TextButton tb  = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Selection(key); }, Color.white, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
            offset += 2;
        }

        new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Cancel(); }, Color.red);
        new TextButton(new Vector2((UIScaler.GetRight() * 3 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Delete", delegate { Delete(); }, Color.red);
        new TextButton(new Vector2((UIScaler.GetRight() * 5 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Copy", delegate { Copy(); });
        new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "New", delegate { NewQuest(); });
    }
        public QuestFixture()
        {
            var config          = Configuration.Default.WithDefaultLoader(requesters: new IRequester[] { new StubbedRequester() });
            var browsingContext = BrowsingContext.New(config);

            _loader = new QuestLoader(browsingContext);
        }
Beispiel #6
0
    public void Save(string file)
    {
        QuestLoader.mkDir(saveLocation());

        // Write to disk
        using (BinaryWriter writer = new BinaryWriter(File.Open(saveLocation() + "/" + file, FileMode.Create)))
        {
            writer.Write(download.bytes);
            writer.Close();
        }

        string section = file.Substring(0, file.Length - ".valkyrie".Length);
        int    localVersion, remoteVersion;

        int.TryParse(localManifest.Get(section, "version"), out localVersion);
        int.TryParse(remoteManifest.Get(section, "version"), out remoteVersion);

        localManifest.Remove(section);
        localManifest.Add(section, remoteManifest.Get(section));


        if (File.Exists(saveLocation() + "/manifest.ini"))
        {
            File.Delete(saveLocation() + "/manifest.ini");
        }
        File.WriteAllText(saveLocation() + "/manifest.ini", localManifest.ToString());

        Destroyer.Dialog();
        DrawList();
    }
Beispiel #7
0
    // This is called by 'start quest' on the main menu
    public void SelectQuest()
    {
        // Find any content packs at the location
        cd = new ContentData(gameType.DataDirectory());
        // Check if we found anything
        if (cd.GetPacks().Count == 0)
        {
            ValkyrieDebug.Log("Error: Failed to find any content packs, please check that you have them present in: " + gameType.DataDirectory() + System.Environment.NewLine);
            Application.Quit();
        }

        // Load configured packs
        cd.LoadContentID("");
        Dictionary <string, string> packs = config.data.Get(gameType.TypeName() + "Packs");

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

        // Get a list of available quests
        Dictionary <string, QuestData.Quest> ql = QuestLoader.GetQuests();

        // Pull up the quest selection page
        new QuestSelectionScreen(ql);
    }
Beispiel #8
0
    public void SelectQuest()
    {
        // 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/";
        }

        // Find any content packs at the location
        cd = new ContentData(contentLocation);
        // Check if we found anything
        if (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 cd.GetPacks())
        {
            cd.LoadContent(pack);
        }

        // Get a list of available quests
        Dictionary <string, QuestLoader.Quest> ql = QuestLoader.GetQuests();

        // Pull up the quest selection page
        new QuestSelection(ql);
    }
Beispiel #9
0
    // This saves the current game to disk.  Will overwrite any previous saves
    public static void Save()
    {
        Game game = Game.Get();

        try
        {
            if (!Directory.Exists(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/Valkyrie"))
            {
                Directory.CreateDirectory(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/Valkyrie");
            }
            if (!Directory.Exists(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/Valkyrie/Save"))
            {
                Directory.CreateDirectory(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/Valkyrie/Save");
            }

            QuestLoader.CleanTemp();
            if (!Directory.Exists(Path.GetTempPath() + "/Valkyrie"))
            {
                Directory.CreateDirectory(Path.GetTempPath() + "/Valkyrie");
            }
            File.WriteAllText(Path.GetTempPath() + "/Valkyrie/save.ini", game.quest.ToString());
            ZipFile zip = new ZipFile();
            zip.AddFile(Path.GetTempPath() + "/Valkyrie/save.ini", "");
            zip.AddDirectory(Path.GetDirectoryName(game.quest.qd.questPath), "quest");
            zip.Save(SaveFile());
        }
        catch (System.Exception)
        {
            ValkyrieDebug.Log("Warning: Unable to write to save file.");
        }
    }
Beispiel #10
0
    // Return a single quest, quest name is without file extension
    public static QuestData.Quest GetSingleQuest(string questName, bool getHidden = false)
    {
        QuestData.Quest quest = null;

        Game game = Game.Get();
        // Look in the user application data directory
        string dataLocation = Game.AppData();

        mkDir(dataLocation);
        mkDir(ContentData.DownloadPath());

        string path = ContentData.DownloadPath() + Path.DirectorySeparatorChar + questName + ".valkyrie";

        QuestLoader.ExtractSinglePackagePartial(path);

        // load quest
        QuestData.Quest q = new QuestData.Quest(Path.Combine(ContentData.TempValyriePath, Path.GetFileName(path)));
        // Check quest is valid and of the right type
        if (q.valid && q.type.Equals(game.gameType.TypeName()))
        {
            // Is the quest hidden?
            if (!q.hidden || getHidden)
            {
                // Add quest to quest list
                quest = q;
            }
        }

        // Return list of available quests
        return(quest);
    }
Beispiel #11
0
        public void Initialize(SceneType scene)
        {
            endFlag = false;

            questManager = gameManager.QuestManager;
            questManager.Initialize();
        }
Beispiel #12
0
 // On quitting
 void OnApplicationQuit()
 {
     // This exists for the editor, because quitting doesn't actually work.
     Destroyer.Destroy();
     // Clean up temporary files
     QuestLoader.CleanTemp();
 }
Beispiel #13
0
    // Start as new character
    // Default stats here
    public void InitCharacter()
    {
        gameStats = new int[(int)GameStats.Count];
        gameStats[(int)GameStats.Time] = 180;  // Testing purposes

        keyItems = new bool[(int)KeyItems.Count];
        // keyItems[(int)KeyItems.Shovel] = true;  // Testing purposes

        // TODO: find a better way to do this part?
        itemRanks    = new int[3][];
        itemRanks[0] = new int[(int)SwordRanks.Count];

        questLoader = GetComponent <QuestLoader>();
        questLoader.Init();
        questCompletion = new bool[questCount.Length][];
        for (int i = 0; i < questCount.Length; i++)
        {
            questCompletion[i] = new bool[questCount[i]];
        }

        playerStats = new int[(int)PlayerStats.Count];
        playerStats[(int)PlayerStats.MAX_HP] = 5;
        playerStats[(int)PlayerStats.HP]     = 5;

        maps = new bool[(int)Maps.Count];
        maps[(int)Maps.Plains] = true;
        bossEnabled            = new bool[(int)Maps.Count];
    }
Beispiel #14
0
    // Copy a quest
    public void Copy(string key)
    {
        Game   game         = Game.Get();
        string dataLocation = Game.AppData() + Path.DirectorySeparatorChar + Game.Get().gameType.TypeName() + "/Editor";

        if (!Directory.Exists(dataLocation))
        {
            Directory.CreateDirectory(dataLocation);
        }

        // Find a new unique directory name
        int i = 1;

        while (Directory.Exists(dataLocation + "/Editor" + game.gameType.QuestName().Translate() + i))
        {
            i++;
        }
        string targetLocation = dataLocation + "/Editor" + game.gameType.QuestName().Translate() + i;

        // Fully extract this scenario before copy if this is a package
        if (Path.GetExtension(Path.GetFileName(key)) == ".valkyrie")
        {
            // extract the full package
            QuestLoader.ExtractSinglePackageFull(ContentData.DownloadPath() + Path.DirectorySeparatorChar + Path.GetFileName(key));
        }

        // Copy files
        try
        {
            DirectoryCopy(key, targetLocation, true);
            // read new quest file
            string[] questData = File.ReadAllLines(targetLocation + "/quest.ini");

            // Search for quest section
            bool questFound = false;
            for (i = 0; i < questData.Length; i++)
            {
                if (questData[i].Equals("[Quest]"))
                {
                    // Inside quest section
                    questFound = true;
                }
                if (questFound && questData[i].IndexOf("name=") == 0)
                {
                    // Add copy to name
                    questFound   = false;
                    questData[i] = questData[i] + " (Copy)";
                }
            }
            // Write back to ini file
            File.WriteAllLines(targetLocation + "/quest.ini", questData);
        }
        catch (System.Exception)
        {
            ValkyrieDebug.Log("Error: Failed to copy quest.");
            Application.Quit();
        }
        // Back to selection
        new QuestEditSelection();
    }
Beispiel #15
0
 public static QuestLoader GetInstance()
 {
     if (m_Instance == null)
     {
         m_Instance = new QuestLoader();
     }
     return(m_Instance);
 }
Beispiel #16
0
 private void LoadQuests()
 {
     if (loadNewChapter)
     {
         questManager.CopyQuestList(QuestLoader.GetQuestList(levelToLoad));
     }
     loadNewChapter = false;
 }
Beispiel #17
0
 public void UnloadLocalQuests()
 {
     if (local_quests_data != null)
     {
         // Clean up temporary files
         QuestLoader.CleanTemp();
         local_quests_data = null;
     }
 }
Beispiel #18
0
    // Return to quest selection
    public void Cancel()
    {
        Destroyer.Dialog();
        // Get a list of available quests
        Dictionary <string, QuestData.Quest> ql = QuestLoader.GetQuests();

        // Pull up the quest selection page
        new QuestSelectionScreen(ql);
    }
Beispiel #19
0
 // --- Management of local quests, when offline ---
 public void LoadAllLocalQuests()
 {
     if (local_quests_data == null)
     {
         // Clean up temporary files
         UnloadLocalQuests();
         // extract and load local quest
         local_quests_data = QuestLoader.GetQuests();
     }
 }
        void Start()
        {
            var markup = Resources.Load <TextAsset> ("quest1").text;

            // Next 2 methods will throw exceptions on any invalid data at markup, take care on it.
            _doc = QuestLoader.LoadMarkup(markup);
            QuestLoader.Validate(_doc);

            // Parsed document valid, we can start processing it.
            RenderPage();
        }
Beispiel #21
0
    // List of quests to copy
    public void Copy()
    {
        // Can copy all quests, not just user
        questList = QuestLoader.GetQuests();
        Game game = Game.Get();

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

        // Header
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName() + " To Copy");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        db = new DialogBox(new Vector2(1, 5f), new Vector2(UIScaler.GetWidthUnits() - 2f, 21f), "");
        db.AddBorder();
        db.background.AddComponent <UnityEngine.UI.Mask>();
        UnityEngine.UI.ScrollRect scrollRect = db.background.AddComponent <UnityEngine.UI.ScrollRect>();

        GameObject    scrollArea      = new GameObject("scroll");
        RectTransform scrollInnerRect = scrollArea.AddComponent <RectTransform>();

        scrollArea.transform.parent = db.background.transform;
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, (UIScaler.GetWidthUnits() - 3f) * UIScaler.GetPixelsPerUnit());
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 1);

        scrollRect.content    = scrollInnerRect;
        scrollRect.horizontal = false;

        // List of quests
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 5, 1.2f), "  " + q.Value.name, delegate { Copy(key); }, Color.black, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().material   = (Material)Resources.Load("Fonts/FontMaterial");
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = Color.white;
            tb.background.transform.parent = scrollArea.transform;
            offset += 2;
        }
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, (offset - 5) * UIScaler.GetPixelsPerUnit());

        // Back to edit selection
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { CancelCopy(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Beispiel #22
0
    public void Save(string file)
    {
        QuestLoader.mkDir(saveLocation());

        // Write to disk
        using (BinaryWriter writer = new BinaryWriter(File.Open(saveLocation() + "/" + file, FileMode.Create)))
        {
            writer.Write(download.bytes);
            writer.Close();
        }
        Destroyer.Dialog();
        DrawList();
    }
Beispiel #23
0
    // List of quests to copy
    public void Copy()
    {
        // Can copy all quests, not just user
        questList = QuestLoader.GetQuests(true);
        Game game = Game.Get();

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

        // Header
        UIElement ui = new UIElement();

        ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3);
        ui.SetText(new StringKey("val", "SELECT_TO_COPY", game.gameType.QuestName()));
        ui.SetFont(Game.Get().gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetLargeFont());

        UIElementScrollVertical scrollArea = new UIElementScrollVertical();

        scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21);
        new UIElementBorder(scrollArea);

        // List of quests
        int offset = 0;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            LocalizationRead.AddDictionary("qst", q.Value.localizationDict);

            ui = new UIElement(scrollArea.GetScrollTransform());
            ui.SetLocation(1, offset, UIScaler.GetWidthUnits() - 5, 1.2f);
            ui.SetText(new StringKey("val", "INDENT", q.Value.name), Color.black);
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetButton(delegate { Copy(key); });
            ui.SetBGColor(Color.white);
            offset += 2;
        }
        scrollArea.SetScrollSize(offset);

        // Back to edit selection
        ui = new UIElement();
        ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
        ui.SetText(CommonStringKeys.BACK, Color.red);
        ui.SetFont(Game.Get().gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(CancelCopy);
        new UIElementBorder(ui, Color.red);
    }
Beispiel #24
0
    // Create a pack with list of quests to edit
    public QuestEditSelection()
    {
        Game game = Game.Get();

        // Get list of unpacked quest in user location (editable)
        // TODO: open/save in packages
        questList = QuestLoader.GetUserUnpackedQuests();

        // If a dialog window is open we force it closed (this shouldn't happen)
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        // Heading
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName());

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        // List of quests
        // FIXME: requires paging
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
        {
            string key = q.Key;
            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Selection(key); }, Color.white, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
            offset += 2;
        }

        // Main menu
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Cancel(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Delete a user quest
        tb = new TextButton(new Vector2((UIScaler.GetRight() * 3 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Delete", delegate { Delete(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Copy a quest
        tb = new TextButton(new Vector2((UIScaler.GetRight() * 5 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Copy", delegate { Copy(); });
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Create a new quest
        tb = new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "New", delegate { NewQuest(); });
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Beispiel #25
0
 public void Set()
 {
     clearDungen      = gameManager.DungeonProcess.GetProcess();
     money            = playerInventory.CurrentMoney();
     bag              = playerInventory.BagList();
     armor            = playerInventory.CurrentArmor();
     leftHand         = playerInventory.LeftHand();
     rightHand        = playerInventory.RightHand();
     arrow            = playerInventory.Arrow();
     accessary        = playerInventory.Accessary();
     depotEquipment   = playerInventory.EquipDepository();
     depotConsumption = playerInventory.DepositoryItem();
     questLoader      = gameManager.QuestManager;
     quest            = gameManager.PlayerQuest.CurrentQuest();
     guildRank        = gameManager.GuildInfo;
 }
Beispiel #26
0
    void Awake()
    {
        QuestLoader.GetInstance().LoadQuest();

        if (m_RunningQuests == null)
        {
            m_RunningQuests = new List <QuestLoader.QuestData> ();
        }

        if (m_DisplayObjects == null)
        {
            m_DisplayObjects = new List <BaseObject> ();
        }

        m_CompleteQuests = 0;
    }
    // Change the dialog to a delete dialog
    public void Delete()
    {
        questList = QuestLoader.GetUserUnpackedQuests();
        Game game = Game.Get();

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

        // Header
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3),
                                     new StringKey("val", "SELECT_TO_DELETE", game.gameType.QuestName()));

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        UIElementScrollVertical scrollArea = new UIElementScrollVertical();

        scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21);
        new UIElementBorder(scrollArea);

        // List of quests
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            LocalizationRead.scenarioDict = q.Value.localizationDict;
            string translation = q.Value.name.Translate();

            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 5, 1.2f),
                                new StringKey("val", "INDENT", translation), delegate { Delete(key); }, Color.black, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().material   = (Material)Resources.Load("Fonts/FontMaterial");
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(1f, 0f, 0f);
            tb.background.transform.SetParent(scrollArea.GetScrollTransform());
            offset += 2;
        }
        scrollArea.SetScrollSize(offset - 5);

        // Back to edit list
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), CommonStringKeys.BACK, delegate { CancelDelete(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Beispiel #28
0
    /* Fin click de ajustes */

    /* Inicio click de misiones */

    /* Abre la pantalla de misiones, carga las misiones activas y sitúa su descripción en los textos de la pantalla */
    public void QuestsBt()
    {
        mainMenu.SetActive(false);
        player.SetActive(false);
        questsMenu.SetActive(true);
        currentWindow = 4;

        Quest[] quests = QuestLoader.GetActiveQuests();

        mission1Text.text   = "Mission: " + quests[0].description;
        mission1Reward.text = "Reward: " + quests[0].reward.ToString();
        if (DataManager.GetMissionCompleted(0))
        {
            mission1Complete.gameObject.SetActive(true);
        }
        else
        {
            mission1Complete.gameObject.SetActive(false);
        }

        mission2Text.text   = "Mission: " + quests[1].description;
        mission2Reward.text = "Reward: " + quests[1].reward.ToString();
        if (DataManager.GetMissionCompleted(1))
        {
            mission2Complete.gameObject.SetActive(true);
        }
        else
        {
            mission2Complete.gameObject.SetActive(false);
        }

        mission3Text.text   = "Mission: " + quests[2].description;
        mission3Reward.text = "Reward: " + quests[2].reward.ToString();
        if (DataManager.GetMissionCompleted(2))
        {
            mission3Complete.gameObject.SetActive(true);
        }
        else
        {
            mission3Complete.gameObject.SetActive(false);
        }
    }
Beispiel #29
0
    // This is called when a quest is selected
    public void StartQuest(QuestData.Quest q)
    {
        if (Path.GetExtension(Path.GetFileName(q.path)) == ".valkyrie")
        {
            // extract the full package
            QuestLoader.ExtractSinglePackageFull(ContentData.DownloadPath() + Path.DirectorySeparatorChar + Path.GetFileName(q.path));
        }

        // Fetch all of the quest data and initialise the quest
        quest = new Quest(q);

        // Draw the hero icons, which are buttons for selection
        heroCanvas.SetupUI();

        // Add a finished button to start the quest
        UIElement ui = new UIElement(Game.HEROSELECT);

        ui.SetLocation(UIScaler.GetRight(-8.5f), UIScaler.GetBottom(-2.5f), 8, 2);
        ui.SetText(CommonStringKeys.FINISHED, Color.green);
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(EndSelection);
        new UIElementBorder(ui, Color.green);

        // Add a title to the page
        ui = new UIElement(Game.HEROSELECT);
        ui.SetLocation(8, 1, UIScaler.GetWidthUnits() - 16, 3);
        ui.SetText(new StringKey("val", "SELECT", gameType.HeroesName()));
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetLargeFont());

        heroCanvas.heroSelection = new HeroSelection();

        ui = new UIElement(Game.HEROSELECT);
        ui.SetLocation(0.5f, UIScaler.GetBottom(-2.5f), 8, 2);
        ui.SetText(CommonStringKeys.BACK, Color.red);
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(Destroyer.QuestSelect);
        new UIElementBorder(ui, Color.red);
    }
Beispiel #30
0
        public void Setup(IEnumerable <IPlayer> players, ScenarioCode scenarioCode)
        {
            if (players == null)
            {
                throw new ArgumentNullException("players");
            }
            if (players.Count() == 0)
            {
                throw new ArgumentException("list of players cannot be empty");
            }
            if (players.Any(x => x == null))
            {
                throw new ArgumentNullException("list of players cannot contain nulls");
            }

            this.players.Clear();

            foreach (var player in players)
            {
                this.players.Add(player);
            }

            var questLoader = new QuestLoader();

            this.QuestArea = questLoader.Load(this, scenarioCode);

            var gameSetup = new GameSetup(this);

            gameSetup.Run();

            CurrentRound = 0;
            CurrentPhase = null;

            foreach (var callback in gameSetupCallbacks)
            {
                callback();
            }

            Run();
        }