示例#1
0
    void Start()
    {
        ge       = new Thread(GetEnegy);
        gameSave = SaveLoadData.LoadData();
        if (!gameSave.everSave)
        {
            for (int i = 0; i < catHolder.Length; i++)
            {
                gameSave.stateSave[i] = catHolder[i].GetComponent <CatControll>().state;
            }
            for (int i = 0; i < catNum.Length; i++)
            {
                gameSave.catNum[i] = catNum[i];
            }
            for (int i = 0; i < catBuyYet.Length; i++)
            {
                gameSave.catBuyYet[i] = catBuyYet[i];
            }
            SaveAllData();
        }
        nowTime    = DateTime.Now;
        timeSpan_f = nowTime.Subtract(gameSave.recordTime);
        Debug.Log(timeSpan_f.TotalSeconds + "秒");
        int deltaenegy = (int)timeSpan_f.TotalSeconds / 300;

        LoadAllData();
        enegy = (enegy + deltaenegy > 50) ? 50 : enegy + deltaenegy;
        if (enegy < 0)
        {
            enegy = 0;
        }
        timeSpan_d = timeSpan_f.Add(new TimeSpan(0, 0, -deltaenegy * 300));
    }
示例#2
0
 public void ShowRecord()
 {
     record_text[0].text = SaveLoadData.LoadData("3x3");
     record_text[1].text = SaveLoadData.LoadData("4x4");
     record_text[2].text = SaveLoadData.LoadData("5x5");
     record_text[3].text = SaveLoadData.LoadData("6x6");
     record_text[4].text = SaveLoadData.LoadData("round_counter");
 }
 void Start()
 {
     string dataCountry = SaveLoadData.LoadData(nameVarCodeCountry, true);
     if (dataCountry == "" || dataCountry == "Null")
         SaveLoadData.SaveData(nameVarCodeCountry, ToCountryCode(Application.systemLanguage), true);
     if (Input.location.isEnabledByUser)
         StartCoroutine(getGeographicalCoordinatesCoroutine());
 }
示例#4
0
    public void LoadData()
    {
        Debug.Log("讀檔");

        GameSave gameSave = new GameSave();

        gameSave = SaveLoadData.LoadData();

        state = gameSave.stateSave[state.uid - 1000];
    }
示例#5
0
 public void NoSetTeam()
 {
     SoundControll.Instance.PlayEffecSound(SoundControll.Instance.buttonClip);
     GlobalValue.instance.gameSave = SaveLoadData.LoadData();
     for (int j = 0; j < 3; j++)
     {
         GlobalValue.instance.catNum[j] = GlobalValue.instance.gameSave.catNum[j];
         AddCatList(j);
     }
     noSetPanel.SetActive(false);
 }
示例#6
0
 public void OnBack()
 {
     GlobalValue.instance.gameSave = SaveLoadData.LoadData();
     for (int i = 0; i < 3; i++)
     {
         GlobalValue.instance.catNum[i] = GlobalValue.instance.gameSave.catNum[i];
     }
     GlobalValue.instance.SaveAllData();
     loading.SetActive(true);
     loading.GetComponent <Loading>().GotoScene("MainScene");
 }
示例#7
0
    // Use this for initialization
    void Start()
    {
        time = Time.time;

        string dataSplashEffect = SaveLoadData.LoadData("SaveSplashEffect", true);

        if (dataSplashEffect == "")
        {
            dataSplashEffect = bSplashEffect.ToString();
        }
        bSplashEffect = int.Parse(dataSplashEffect);
    }
    IEnumerator GetScoreCountry()
    {
        string dataCountry = SaveLoadData.LoadData("CodeCountry", true);

        if (dataCountry == "")
        {
            dataCountry = "Null";
        }
        WWWForm form = new WWWForm();

        form.AddField("table", "useBusSubway");
        form.AddField("limit", "30");
        form.AddField("country", dataCountry);
        WWW   _resuilt = new WWW(Modules.linkGetCountry, form);
        float runTime  = 0f;

        while (!_resuilt.isDone && runTime < Modules.maxTime)
        {
            runTime += Modules.requestTime;
            yield return(new WaitForSeconds(Modules.requestTime));
        }
        yield return(_resuilt);

        if (_resuilt.text != "null" && _resuilt.text != "")
        { //hoan thanh
            //print(_resuilt.text);
            string[] dataLine = _resuilt.text.Split('\n');
            int      dRun     = 0;
            for (int i = 0; i < dataLine.Length; i++)
            {
                if (dataLine[i] == "")
                {
                    continue;
                }
                string[] data     = dataLine[i].Split(';');
                int      scoreNow = int.Parse(data[2]);
                if (scoreNow >= Modules.totalScore)
                {
                    Modules.fbNameEnemy.Add(data[0]);
                    Modules.fbHighScore.Add(scoreNow);
                    Modules.fbAvatarEnemy.Add(data[1]);
                    //print(data[0] + "=>" + scoreNow.ToString() + ";" + data[1]);
                    dRun++;
                }
            }
            //statusGet = true;
        }
        else
        { //qua lau, khong mang, cau lenh loi
          //statusGet = false;
        }
        yield break;
    }
    //private bool statusGet = false;
    IEnumerator PostScore()
    {
#if UNITY_WEBGL
        string idDevice = Modules.fbID;
#else
        string idDevice = SystemInfo.deviceUniqueIdentifier;
#endif
        if (idDevice == "Null")
        {
            statusPost = true;
            yield break;
        }
        //string nameDevice = SystemInfo.deviceName;
        string dataCountry = SaveLoadData.LoadData("CodeCountry", true);
        if (dataCountry == "")
        {
            dataCountry = "Null";
        }
        WWWForm form = new WWWForm();
        form.AddField("table", "useBusSubway");
        form.AddField("idUser", idDevice);
        form.AddField("name", Modules.fbName);
        form.AddField("avatar", Modules.fbLinkAvatar == "" ? "Null" : Modules.fbLinkAvatar);
        form.AddField("score", Mathf.RoundToInt(Modules.totalScore));
        form.AddField("country", dataCountry);
        form.AddField("win", Modules.winNow);
        form.AddField("lose", Modules.loseNow);
        form.AddField("fail", Modules.failNow);
        WWW   _resuilt = new WWW(Modules.linkPost, form);
        float runTime  = 0f;
        while (!_resuilt.isDone && runTime < Modules.maxTime)
        {
            runTime += Modules.requestTime;
            yield return(new WaitForSeconds(Modules.requestTime));
        }
        yield return(_resuilt);

        if (_resuilt.text == "Done")
        { //hoan thanh
            statusPost      = true;
            Modules.winNow  = 0;
            Modules.loseNow = 0;
            Modules.failNow = 0;
        }
        else
        { //qua lau, khong mang, cau lenh loi
            statusPost = false;
        }
        yield break;
    }
示例#10
0
    void Start()
    {
        ready_now          = false;
        timer_text.enabled = false;

        if (PlayerPrefs.HasKey("selected_language"))
        {
            cur_language = SaveLoadData.LoadDataInt("selected_language");
        }
        if (PlayerPrefs.HasKey("agree_privacy_polit") == false || SaveLoadData.LoadDataInt("agree_privacy_polit") == 0)
        {
            privacy_polit_panel.SetActive(true);
        }
        else
        {
            agree_privacy_polit = SaveLoadData.LoadDataInt("agree_privacy_polit");
            privacy_polit_panel.SetActive(false);
        }
        if (PlayerPrefs.HasKey("3x3"))
        {
            record_int[0] = int.Parse(SaveLoadData.LoadData("3x3"));
        }
        if (PlayerPrefs.HasKey("4x4"))
        {
            record_int[1] = (int)int.Parse(SaveLoadData.LoadData("4x4"));
        }
        if (PlayerPrefs.HasKey("5x5"))
        {
            record_int[2] = (int)int.Parse(SaveLoadData.LoadData("5x5"));
        }
        if (PlayerPrefs.HasKey("6x6"))
        {
            record_int[3] = (int)int.Parse(SaveLoadData.LoadData("6x6"));
        }
        if (PlayerPrefs.HasKey("round_counter"))
        {
            record_int[4] = (int)int.Parse(SaveLoadData.LoadData("round_counter"));
        }
    }
    IEnumerator GetScoreCountry()
    {
        string dataCountry = SaveLoadData.LoadData("CodeCountry", true);

        if (dataCountry == "")
        {
            dataCountry = "Null";
        }
        WWWForm form = new WWWForm();

        form.AddField("table", "useBusSubway");
        form.AddField("limit", "30");
        form.AddField("country", dataCountry);
        WWW   _resuilt = new WWW(Modules.linkGetCountry, form);
        float runTime  = 0f;

        while (!_resuilt.isDone && runTime < Modules.maxTime)
        {
            runTime += Modules.requestTime;
            yield return(new WaitForSeconds(Modules.requestTime));
        }
        yield return(_resuilt);

        if (_resuilt.text != "null" && _resuilt.text != "")
        { //hoan thanh
            //print(_resuilt.text);
            listAvatarCountry = new List <Texture2D>();
            string[] dataLine = _resuilt.text.Split('\n');
            if (panelTopCountry != null)
            {
                Destroy(panelTopCountry);
            }
            panelTopCountry = Instantiate(listTempCountry, Vector3.zero, Quaternion.identity) as GameObject;
            Transform panelContent = panelTopCountry.transform.Find("Content");
            Transform panelItem    = panelContent.transform.Find("Item");
            for (int i = 0; i < dataLine.Length; i++)
            {
                if (dataLine[i] == "")
                {
                    continue;
                }
                GameObject newItem = panelItem.gameObject;
                if (i > 0)
                {
                    newItem = Instantiate(panelItem.gameObject, Vector3.zero, Quaternion.identity) as GameObject;
                    newItem.transform.SetParent(panelContent, false);
                }
                if (i % 2 != 0)
                {
                    newItem.GetComponent <Image>().color = Modules.colorListLine;
                }
                Transform tranAvatar = newItem.transform.Find("Avatar");
                Transform tranName   = newItem.transform.Find("Name");
                Transform tranScore  = newItem.transform.Find("Score");
                Transform tranIndex  = newItem.transform.Find("Index");

                Image fbAvatar = tranAvatar.GetComponent <Image>();
                Text  fbName   = tranName.GetComponent <Text>();
                Text  fbScore  = tranScore.GetComponent <Text>();
                Text  fbIndex  = tranIndex.GetComponent <Text>();

                string[] data = dataLine[i].Split(';');
                fbName.text = data[0];
                listAvatarCountry.Add(null);
                if (Modules.containAchievement.activeSelf)
                {
                    StartCoroutine(LoadImageCountry(data[1], i, fbAvatar));
                }
                fbScore.text = data[2];
                fbIndex.text = (i + 1).ToString();
            }
            panelTopCountry.transform.position = pointListCountry;
            panelTopCountry.transform.SetParent(parentListCountry.transform, false);
            panelLoadingC.SetActive(false);
            //statusGet = true;
        }
        else
        { //qua lau, khong mang, cau lenh loi
            //statusGet = false;
            panelLoadingC.SetActive(true);
            panelLoadingC.transform.GetComponent <TextLoading>().CallStart();
        }
        yield break;
    }
 private void OnEnable()
 {
     saveData     = delegate { SaveLoadData.SaveData(dataPath, SaveLoadData.genericOperatorContainer); };
     loadData     = delegate { SaveLoadData.LoadData(dataPath); };
     operatorList = new List <GenericOperator>();
 }
示例#13
0
    }//存檔

    public void LoadAllData()
    {
        gameSave = SaveLoadData.LoadData();
        if (!gameSave.everSave)
        {
            for (int i = 0; i < catHolder.Length; i++)
            {
                gameSave.stateSave[i] = catHolder[i].GetComponent <CatControll>().state;
            }
            for (int i = 0; i < catNum.Length; i++)
            {
                gameSave.catNum[i] = catNum[i];
            }
            for (int i = 0; i < catBuyYet.Length; i++)
            {
                gameSave.catBuyYet[i] = catBuyYet[i];
            }
            for (int i = 0; i < ItemHolder.instance.globleItems.Count; i++)
            {
                gameSave.item_id[i]     = ItemHolder.instance.globleItems[i].id;
                gameSave.item_Use[i]    = ItemHolder.instance.globleItems[i].itemUse;
                gameSave.item_amount[i] = ItemHolder.instance.globleItems[i].amount;
                gameSave.itemOrder[i]   = ItemHolder.instance.globleItems[i].order;
            }
            for (int i = 0; i < QuestHolder.instance.quest.Count; i++)
            {
                gameSave.quest_complete[i] = QuestHolder.instance.quest[i].isComplete;
                gameSave.quest_reward[i]   = QuestHolder.instance.quest[i].isReward;
                gameSave.quest_id[i]       = QuestHolder.instance.quest[i].id;
            }//存現在任務資料
            for (int i = 0; i < everTeach.Length; i++)
            {
                gameSave.everTeach[i] = everTeach[i];
            }//存是否教學過
            for (int i = 0; i < FishHolder.instance.fishValue.fishAmount.Length; i++)
            {
                gameSave.fishAmount[i] = FishHolder.instance.fishValue.fishAmount[i];
            }
            for (int i = 0; i < FishHolder.instance.fishValue.fishBaitAmount.Length; i++)
            {
                gameSave.fishBaitAmount[i] = FishHolder.instance.fishValue.fishBaitAmount[i];
            }
            for (int i = 0; i < ItemHolder.instance.storeCount.Length; i++)
            {
                gameSave.storeCount[i] = ItemHolder.instance.storeCount[i];
            }//存是否買過
            gameSave.rodQuality  = FishHolder.instance.fishValue.rodQuality;
            gameSave.baitQuality = FishHolder.instance.fishValue.baitQuality;
        }
        for (int i = 0; i < catHolder.Length; i++)
        {
            catHolder[i].GetComponent <CatControll>().state = gameSave.stateSave[i];
        }
        for (int i = 0; i < catNum.Length; i++)
        {
            catNum[i] = gameSave.catNum[i];
        }
        for (int i = 0; i < level.Length; i++)
        {
            level[i] = gameSave.level[i];
        }
        for (int i = 0; i < mission.Length; i++)
        {
            mission[i] = gameSave.mission[i];
        }
        for (int i = 0; i < catBuyYet.Length; i++)
        {
            if (i < 3)
            {
                catBuyYet[i] = true;
            }
            else
            {
                catBuyYet[i] = gameSave.catBuyYet[i];
                if (!catBuyYet[i])
                {
                    nowUnlockCat = i;
                    break;
                }
            }
        }
        for (int i = 0; i < ItemHolder.instance.globleItems.Count; i++)
        {
            ItemHolder.instance.globleItems[i].id      = gameSave.item_id[i];
            ItemHolder.instance.globleItems[i].itemUse = gameSave.item_Use[i];
            ItemHolder.instance.globleItems[i].amount  = gameSave.item_amount[i];
            ItemHolder.instance.globleItems[i].order   = gameSave.itemOrder[i];
        }
        for (int i = 0; i < QuestHolder.instance.quest.Count; i++)
        {
            QuestHolder.instance.quest[i].isComplete = gameSave.quest_complete[i];
            QuestHolder.instance.quest[i].isReward   = gameSave.quest_reward[i];
            QuestHolder.instance.quest[i].id         = gameSave.quest_id[i];
        }//讀取現在任務資料
        for (int i = 0; i < everTeach.Length; i++)
        {
            everTeach[i] = gameSave.everTeach[i];
        }//存是否教學過
        for (int i = 0; i < ItemHolder.instance.storeCount.Length; i++)
        {
            ItemHolder.instance.storeCount[i] = gameSave.storeCount[i];
        }//存是否買過
        ItemHolder.instance.amount = gameSave.item_all;
        gold         = gameSave.gold;
        exp          = gameSave.exp;
        enegy        = gameSave.enegy;
        nowStory     = gameSave.nowStory;
        nowUnlockCat = gameSave.nowUnlockCat;
        FishHolder.instance.fishValue.AutoisOn = gameSave.FishAuto;
        FishHolder.instance.fishValue.fishDate = gameSave.recordFishingTime;
        for (int i = 0; i < FishHolder.instance.fishValue.fishAmount.Length; i++)
        {
            FishHolder.instance.fishValue.fishAmount[i] = gameSave.fishAmount[i];
        }
        for (int i = 0; i < FishHolder.instance.fishValue.fishBaitAmount.Length; i++)
        {
            FishHolder.instance.fishValue.fishBaitAmount[i] = gameSave.fishBaitAmount[i];
        }
        FishHolder.instance.fishValue.rodQuality  = gameSave.rodQuality;
        FishHolder.instance.fishValue.baitQuality = gameSave.baitQuality;

        if (gameSave.recordTime.DayOfYear != LeapYear())
        {
            if (DateTime.Now.DayOfYear > gameSave.recordTime.DayOfYear)
            {
                daliyBonus = false;
            }
            else
            {
                daliyBonus = gameSave.daliybonus;
            }
        }
        else
        {
            if (DateTime.Now.DayOfYear < gameSave.recordTime.DayOfYear)
            {
                daliyBonus = false;
            }
            else
            {
                daliyBonus = gameSave.daliybonus;
            }
        }
    }//讀檔