예제 #1
0
    public static void SaveMissionDataCache(bool submitToServer = false)
    {
        string dataSave       = "";
        string dataSendServer = "";

        for (int i = 0; i < dataMissionCache.Length; i++)
        {
            dataSave += dataMissionCache[i].Mission + "-" + dataMissionCache[i].Score + "-" + dataMissionCache[i].Star + "-" + dataMissionCache[i].Open + ",";
            //Chi gui nhung mission da open len server
            if (dataMissionCache[i].Open == 1)
            {
                if (dataSendServer.Length > 0)
                {
                    dataSendServer += ",";
                }
                dataSendServer += dataMissionCache[i].Mission + "-" + dataMissionCache[i].Score + "-" + dataMissionCache[i].Star + "-" + dataMissionCache[i].Open;
            }
        }
        Debug.Log("Data save " + dataSave);
        PlayerPrefs.SetString(Mission_data_key, dataSave);
        if (submitToServer)
        {
            Debug.Log("Data send server  " + dataSendServer);
            AudioControl.getMonoBehaviour().StartCoroutine(DHS.PostMeInfoMissionUpdate(FB.UserId, dataSendServer));
        }
    }
예제 #2
0
    void UpdateClientToServer()
    {
        Debug.Log("----------------------Dua du lieu moi len server----------------------");
        AudioControl.getMonoBehaviour().StartCoroutine(DHS.PostMeCurrentMission(currentMissionClient));
        string data_mission = "";

        for (int i = 0; i < DataCache.dataMissionCache.Length; i++)
        {
            //Chi gui nhung mission da open len server
            if (DataCache.dataMissionCache[i].Open == 1)
            {
                if (data_mission.Length > 0)
                {
                    data_mission += ",";
                }
                data_mission += DataCache.dataMissionCache[i].Mission + "-" + DataCache.dataMissionCache[i].Score + "-" + DataCache.dataMissionCache[i].Star + "-" + DataCache.dataMissionCache[i].Open;
            }
            DialogLoadingFB.HideFBLoading();
        }
        AudioControl.getMonoBehaviour().StartCoroutine(DHS.PostMeInfoMissionUpdate(FB.UserId, "" + data_mission));
        DataCache.SaveAchievementCache(true);
    }