示例#1
0
文件: focus.cs 项目: kasher7/COMP585
    void Start()
    {
        myData    = DataLogicNew.Load();
        text.text = "In Quest";
        if (text.text != "Failed")
        {
            // checks if he is worthy
            Debug.Log("daycounter " + myData.DayCounter);
            if (myData.DayCounter == 27)
            {
                for (int i = 0; i < (myData.QuestCompleteLog.Length / 100) - 1; i++)
                {
                    bool metReqirement = false;
                    for (int j = 0; j < 100; j++)
                    {
                        if (myData.QuestCompleteLog[i * 100 + j])
                        {
                            metReqirement = true;
                        }
                    }
                    if (!metReqirement)
                    {
                        text.text = "Failed";
                    }
                }
            }
            if (questConstants.questType == "Strength")
            {
                Debug.Log(myData.PreStrengthQuestLine.Length);
                questTypes.text = myData.PreStrengthQuestLine[myData.DayCounter];
            }
            else if (questConstants.questType == "Charisma")
            {
                questTypes.text = myData.PreCharismaQuestLine[myData.DayCounter];
            }
            else if (questConstants.questType == "Intelligence")
            {
                questTypes.text = myData.PreIntellectQuestLine[myData.DayCounter];
            }
        }
        else
        {
            Debug.Log("Failing text");
        }
        // setting up questing quates

        // img = background.GetComponent<Image>();
        // img.color = Color.blue;
        timerText.text = (timeLeftSec - timeLeftSec % 60) / 60 + " minutes " + timeLeftSec % 60 + " seconds left";
        // questTypes.text = "you are on a " + questConstants.questType + " quest!";
        focused             = Application.isFocused;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        timer       = 0;
        fingerCount = 0;
        isSleep     = false;
        // text.text = "Failed";
    }
示例#2
0
 void Start()
 {
     myData = DataLogicNew.Load();
     ;
     Debug.Log("print Date");
     Debug.Log(myData.CurrentDate);
     Debug.Log(myData.StartDate);
     myData = DataLogicNew.Load();
 }
示例#3
0
 void Start()
 {
     myData     = DataLogicNew.Load();
     dayButtons = GameObject.FindGameObjectsWithTag("calender");
     // for some reason it mal functions on Android
     // for (int i =0; i< dayButtons.Length ; i++){
     //     // int capturedIterator = i;
     //     // Debug.Log(dayButtons[i].GetComponentInChildren<Text>().text);
     //     dayButtons[i].GetComponent<Button>().onClick.AddListener(() => dayClicked(i));
     // }
 }
示例#4
0
 void Start()
 {
     myData          = DataLogicNew.Load();
     name.text       = "Name: " + myData.PlayerName;
     lvl.text        = "Level: " + myData.PlayerLevel;
     charisLvl.text  = "Charisma Level: " + myData.CharismaLevel;
     strenLvl.text   = "Strength Level: " + myData.StrengthLevel;
     intelLvl.text   = "Intellect Level: " + myData.IntellectLevel;
     totalTime.text  = "Total time spent: " + (myData.TotalEXP / PlayerPrefs.GetInt("difficulty")).ToString() + "mins";
     charisTime.text = "Charisma time spent: " + (myData.CharismaEXP / PlayerPrefs.GetInt("difficulty")).ToString() + "mins";
     strenTime.text  = "Strength time spent: " + (myData.StrengthEXP / PlayerPrefs.GetInt("difficulty")).ToString() + "mins";
     intelTime.text  = "Intellect time spent: " + (myData.IntellectEXP / PlayerPrefs.GetInt("difficulty")).ToString() + "mins";
 }
示例#5
0
文件: goBack.cs 项目: kasher7/COMP585
    public void goBackMenu()
    {
        DataObject myData = new DataObject();

        myData = DataLogicNew.Load();
        if (myData.FirstTimePlaying)
        {
            SceneManager.LoadScene("initializeGame");
        }
        else
        {
            SceneManager.LoadScene("menu");
        }
    }
示例#6
0
    // Start is called before the first frame update


    void Start()
    {
        int expGained = questConstants.questTime * PlayerPrefs.GetInt("difficulty");

        type.text = "Quest Type: " + questConstants.questType;
        time.text = "Time Spent: " + questConstants.questTime;
        exp.text  = "Exp gained: +" + expGained;
        //Data update logic
        DataObject myData = new DataObject();

        myData = DataLogicNew.Load();

        if (questConstants.questType == "Strength")
        {
            story.text          = myData.PostStrengthQuestLine[myData.DayCounter];
            myData.StrengthEXP += expGained;
            myData.DailyStrengthEXP[myData.DayCounter] += expGained;
        }
        else if (questConstants.questType == "Charisma")
        {
            story.text          = myData.PostCharismaQuestLine[myData.DayCounter];
            myData.CharismaEXP += expGained;
            myData.DailyCharismaEXP[myData.DayCounter] += expGained;
        }
        else if (questConstants.questType == "Intelligence")
        {
            story.text           = myData.PostIntellectQuestLine[myData.DayCounter];
            myData.IntellectEXP += expGained;
            myData.DailyIntellectEXP[myData.DayCounter] += expGained;
        }
        myData.DailyTotalEXP[myData.DayCounter] = myData.DailyStrengthEXP[myData.DayCounter] +
                                                  myData.DailyIntellectEXP[myData.DayCounter] +
                                                  myData.DailyCharismaEXP[myData.DayCounter];
        //Dont go over the max index length
        //it a temp solution
        myData.QuestCompleteLog[myData.DayCounter * 100 + myData.DailyQuestCounter] = true;
        myData.DailyQuestCounter    += 1;
        myData.QuestAmountCompleted += 1;
        Debug.Log(myData.QuestCompleteLog);
        DataLogicNew.Save(myData);
        if (myData.DayCounter == 27)
        {
            status.text = "Congradulations! You have completed the game.";
        }
        else
        {
            status.text = "Quest completed";
        }
    }
示例#7
0
    void Start()
    {
        int        expGained = questConstants.timeSpent * 10;
        DataObject myData    = DataLogicNew.Load();

        if (myData.DayCounter == 27)
        {
            // check for day 28 ie last day
            story.text = "You have completed the game but you didn't beat the final boss. Start a new character and try again";
        }
        else
        {
            if (questConstants.questType == "Strength")
            {
                story.text          = myData.FailureQuestLine[myData.DayCounter];
                myData.StrengthEXP += expGained;
                myData.DailyStrengthEXP[myData.DayCounter] += expGained;
            }
            else if (questConstants.questType == "Charisma")
            {
                story.text          = myData.FailureQuestLine[myData.DayCounter];
                myData.CharismaEXP += expGained;
                myData.DailyCharismaEXP[myData.DayCounter] += expGained;
            }
            else if (questConstants.questType == "Intelligence")
            {
                story.text           = myData.FailureQuestLine[myData.DayCounter];
                myData.IntellectEXP += expGained;
                myData.DailyIntellectEXP[myData.DayCounter] += expGained;
            }
        }

        myData.DailyTotalEXP[myData.DayCounter] = myData.DailyStrengthEXP[myData.DayCounter] +
                                                  myData.DailyIntellectEXP[myData.DayCounter] +
                                                  myData.DailyCharismaEXP[myData.DayCounter];
        myData.QuestCompleteLog[myData.DayCounter * 100 + myData.DailyQuestCounter] = false;
        myData.DailyQuestCounter += 1;
        DataLogicNew.Save(myData);
    }
示例#8
0
    void Start()
    {
        // DataLogic.SaveGameData(myData);
        myData = DataLogicNew.FirstLoad();
        Debug.Log(myData.FirstTimePlaying);
        name.text = " ";
        if (myData.FirstTimePlaying)
        {
            //TODO let user pick name
            myData.PlayerName    = name.text;
            myData.QuestLength   = 28;
            myData.StartDate     = System.DateTime.Now.ToString();
            myData.CurrentDate   = System.DateTime.Now.ToString();
            myData.DayCounter    = System.Convert.ToInt32((System.DateTime.Parse(myData.CurrentDate) - System.DateTime.Parse(myData.StartDate)).TotalDays);
            myData.LastDayPlayed = System.Convert.ToInt32((System.DateTime.Parse(myData.CurrentDate) - System.DateTime.Parse(myData.StartDate)).TotalDays);
            Debug.Log("printing dates");
            Debug.Log(myData.CurrentDate);
            Debug.Log(myData.LastDayPlayed);
            //TODO I'm just assuming these arrays initialize to all zeros...If not we'll probably find out later
            myData.TotalEXP             = 0;
            myData.PlayerLevel          = 0;
            myData.StrengthEXP          = 0;
            myData.CharismaEXP          = 0;
            myData.IntellectEXP         = 0;
            myData.StrengthLevel        = 0;
            myData.CharismaLevel        = 0;
            myData.IntellectLevel       = 0;
            myData.QuestAmountCompleted = 0;

            //initialize everything in questcompletelog to false
            myData.QuestCompleteLog = new bool[2800];
            //TODO gross, but I had to hardcode in the number for this, should
            //fix so is always equal to first dimension of quest complete log later
            for (int i = 0; i < myData.QuestCompleteLog.Length; i++)
            {
                myData.QuestCompleteLog[i] = false;
            }
            myData.DailyQuestCounter = 0;


            Debug.Log("quest log");
            Debug.Log(myData.QuestCompleteLog);

            //TODO initialize all to zero?
            myData.DailyCharismaEXP  = new int[28];
            myData.DailyStrengthEXP  = new int[28];
            myData.DailyIntellectEXP = new int[28];
            myData.DailyTotalEXP     = new int[28];
            Debug.Log("daily exp");
            Debug.Log(myData.DailyTotalEXP);
            // Array.Clear(myData.DailyTotalEXP,0,myData.DailyTotalEXP.Length);
            Debug.Log("clearing");
            Debug.Log(myData.DailyTotalEXP.Length);
            //Initialize first time playing trigger to true
            //make sure to change to false after intializing game

            //Here We load the quest txt content
            TextAsset preStrengthQuestLine   = (TextAsset)Resources.Load("QuestText/StrengthQuestLinePre");
            TextAsset preIntellectQuestLine  = (TextAsset)Resources.Load("QuestText/IntellectQuestLinePre");
            TextAsset preCharismaQuestLine   = (TextAsset)Resources.Load("QuestText/CharismaQuestLinePre");
            TextAsset postStrengthQuestLine  = (TextAsset)Resources.Load("QuestText/StrengthQuestLinePost");
            TextAsset postIntellectQuestLine = (TextAsset)Resources.Load("QuestText/IntellectQuestLinePost");
            TextAsset postCharismaQuestLine  = (TextAsset)Resources.Load("QuestText/CharismaQuestLinePost");
            TextAsset postFailureQuestLine   = (TextAsset)Resources.Load("QuestText/FailureQuestLinePost");

            myData.PreStrengthQuestLine   = preStrengthQuestLine.text.Split('#');
            myData.PreCharismaQuestLine   = preCharismaQuestLine.text.Split('#');
            myData.PreIntellectQuestLine  = preIntellectQuestLine.text.Split('#');
            myData.PostStrengthQuestLine  = postStrengthQuestLine.text.Split('#');
            myData.PostCharismaQuestLine  = postCharismaQuestLine.text.Split('#');
            myData.PostIntellectQuestLine = postIntellectQuestLine.text.Split('#');
            myData.FailureQuestLine       = postFailureQuestLine.text.Split('#');

            //set difficult to defult 1
            PlayerPrefs.SetInt("difficulty", 1);
            PlayerPrefs.SetInt("audio", 1);
        }
        else
        {
            Debug.Log("loading");
            myData = DataLogicNew.Load();
            SceneManager.LoadScene("menu");
        }
    }