SetCurrent() public static method

public static SetCurrent ( string name ) : void
name string
return void
    static string state = "";                //Store the Data to PlayerPrefs at some point
    public string StatusUpdate()             //Gets called any time the game wants to know what the status of the quest is, also when the quest is first started
    {
        InventoryData.OnChange += InvUpdate; //start listening to inventory updates
        if (state.Equals(""))
        {
            state = PlayerPrefs.GetString("SampleQuest", "blanke");                      //if the file is just initialized, read the data from disk, default to "blank" if it's the first time
        }
        PlayerPrefs.SetString("SampleQuest", state);                                     //Store the data again in case it changes
        switch (state)                                                                   //switch between the set states
        {
        case "blank":                                                                    //blank state can be used as a startup function
            NotificationManager.AddNotification("Quest Started", "Started SampleQuest"); //Adding notification that the quest started
            state = "Pick up Diary (0/1)";
            QuestDictionary.SetCurrent("SampleQuest");
            break;

        case "Pick up Diary (0/1)":
            break;

        case "Pick up Diary (1/1)":
            state = "Finished";
            NotificationManager.AddNotification("Quest Complete", "Finished SampleQuest"); //adding notification that the quest is finished
            //InventoryData.OnChange -= InvUpdate;  //stop listening to inventory updates
            PlayerPrefs.Save();                                                            //Writes all data changes to disk just in case
            break;
        }
        return(state);          //Return a string stating the status of the quest
    }
Beispiel #2
0
    public string StatusUpdate()
    {
        if (state.Equals(""))
        {
            if (JsonFile.save.Quests.QuestData.ContainsKey("Beavers"))
            {
                state = (string)JsonFile.save.Quests.QuestData["Beavers"][0];
            }
            else
            {
                state = "blank";
                JsonFile.save.Quests.QuestData.Add("Beavers", new object[] { state });
            }
        }
        switch (state)
        {
        case "blank":
            break;

        case "blank2":
            break;

        case "bridge":
            break;

        case "stoiyt":
            NotificationManager.AddNotification("Quest Started", "A mystery with wooden proportions");
            QuestDictionary.SetCurrent("Beavers");
            state = "Go to the scene of the crime";
            break;

        case "Go to the scene of the crime":
            break;

        //stuff happens here... WIP

        case "Return to Desislav":
            break;

        case "Finished":
            break;
        }
        return(state);
    }
    public string StatusUpdate()        //Gets called any time the game wants to know what the status of the quest is, also when the quest is first started
    {
        if (state.Equals(""))
        {
            if (JsonFile.save.Quests.QuestData.ContainsKey("RebuildBridge"))                    //If the quest data entry exists in the data read from file
            {
                state    = (string)JsonFile.save.Quests.QuestData["RebuildBridge"][0];
                items[0] = (bool)JsonFile.save.Quests.QuestData["RebuildBridge"][1];                    //Retrieve data from object array at the index of the quest string
                items[1] = (bool)JsonFile.save.Quests.QuestData["RebuildBridge"][2];
                items[2] = (bool)JsonFile.save.Quests.QuestData["RebuildBridge"][3];
            }
            else
            {
                state = "blank";
                JsonFile.save.Quests.QuestData.Add("RebuildBridge", new object[] { state, false, false, false }); //New blanket array if one does not exist yet with default valuess
                SaveData.queueSave = true;                                                                        //Force a data write
            }
        }
        switch (state)                  //switch between the set states
        {
        case "blank":
            break;

        case "blank2":
            break;

        case "Styoit":
            state = "Collected: ";
            NotificationManager.AddNotification("Quest Started", "Rebuild Town Bridge");                 //Adding notification that the quest started
            QuestDictionary.SetCurrent("Rebuild Town Bridge");
            break;

        case "Collected: ":
            break;

        case "Solve the mystery of foresters wood":
            // Place for second quest that has to do with beavers
            break;

        case "wait until midnight for bridge to be built":
            break;

        case "quest finished":
            state = "Finished";
            NotificationManager.AddNotification("Quest Complete", "Rebuild Town Bridge");                   //adding notification that the quest is finished
            break;
        }
        if (state.Equals("Collected: "))                //Create dynamic list of items
        {
            state += ("\nWood: " + items[0] + "\nTools: " + items[1] + "\nCider: " + items[2]);
        }
        bool changed = false;

        if (!state.Equals((string)JsonFile.save.Quests.QuestData["RebuildBridge"][0]))
        {
            JsonFile.save.Quests.QuestData["RebuildBridge"][0] = state;
            changed = true;
        }
        if (items[0] != ((bool)JsonFile.save.Quests.QuestData["RebuildBridge"][1]))
        {
            JsonFile.save.Quests.QuestData["RebuildBridge"][1] = items[0];
            changed = true;
        }
        if (items[1] != ((bool)JsonFile.save.Quests.QuestData["RebuildBridge"][2]))
        {
            JsonFile.save.Quests.QuestData["RebuildBridge"][1] = items[1];
            changed = true;
        }
        if (items[2] != ((bool)JsonFile.save.Quests.QuestData["RebuildBridge"][3]))
        {
            JsonFile.save.Quests.QuestData["RebuildBridge"][1] = items[2];
            changed = true;
        }
        if (changed)
        {
            SaveData.queueSave = true; //Writes all data changes to disk just in case
        }
        return(state);                 //Return a string stating the status of the quest
    }