예제 #1
0
    void Awake()
    {
        FileStream   fileStream         = new FileStream(Application.persistentDataPath + "/" + CONFIG_PATH, FileMode.Open);
        MemoryStream uncompressedStream = new MemoryStream();

        CompressionUtility.DecompressStream(fileStream, uncompressedStream);

        BinaryFormatter bft = new BinaryFormatter();

        DataResource.Resource = (DataSet)bft.Deserialize(uncompressedStream);

        fileStream.Close();
        uncompressedStream.Close();
    }
예제 #2
0
    void Awake()
    {
        FileStream fileStream = new FileStream(Application.persistentDataPath + "/" + CONFIG_PATH, FileMode.Open);

        /*
         * BinaryWriter writer = new BinaryWriter(fileStream);
         * writer.Write(this.m_wwwConfigTable.bytes);
         * writer.Close();
         */
        MemoryStream uncompressedStream = new MemoryStream();

        CompressionUtility.DecompressStream(fileStream, uncompressedStream);

        BinaryFormatter bft = new BinaryFormatter();

        DataResource.Resource = (DataSet)bft.Deserialize(uncompressedStream);

        fileStream.Close();
        uncompressedStream.Close();
    }
예제 #3
0
    IEnumerator Initialize()
    {
        CommunicationUtility.Instance.DisconnectToServer();
        CommunicationUtility.Instance.ConnectToServer();

        while (!CommunicationUtility.Instance.IsConnectedToServer)
        {
            yield return(null);
        }
        VersionRequestParameter request = new VersionRequestParameter();

        request.PlatformType = CommonHelper.PlatformType;
        CommunicationUtility.Instance.GetVersion(this, "ReceivedVersion", true, request);
        while (!this.IsGetServerVersion)
        {
            yield return(null);
        }
        if (CommonHelper.PlatformType == ConfigUtilities.Enums.PlatformType.iOS)
        {
            if (iOSCenter.Instance.AccountID < 0)
            {
                this.m_UIWindowUserLogin.ShowWindow();
            }
            while (iOSCenter.Instance.AccountID < 0)
            {
                yield return(null);
            }
        }
        AudioController.PlayMusic("Loading");
        this.m_ProgressBar.SetActive(true);
        CommunicationUtility.Instance.GetConfigTableMD5(this, "ReceivedConfigTableMD5", true);
        while (!this.IsGetServerMD5)
        {
            yield return(null);
        }
        this.LoadConfigTable();
        byte[] localMD5 = null;
        if (this.m_wwwConfigTable != null)
        {
            while (!this.m_wwwConfigTable.isDone)
            {
                yield return(null);
            }
            MemoryStream ms = new MemoryStream(this.m_wwwConfigTable.bytes);
            localMD5 = MD5.Create().ComputeHash(ms);
            ms.Close();
        }
        if (localMD5 == null || !localMD5.IsEqualByteArray(this.m_ServerConfigTableMD5))
        {
            string configUrl = string.Format(DataResource.CONFIG_TABLE_URL, ClientVersion.Instance.Version);
            this.m_wwwConfigTable = new WWW(configUrl);
            yield return(this.m_wwwConfigTable);
        }

        FileStream   fileStream = new FileStream(Application.persistentDataPath + "/" + CONFIG_PATH, FileMode.Create);
        BinaryWriter writer     = new BinaryWriter(fileStream);

        writer.Write(this.m_wwwConfigTable.bytes);
        writer.Close();

        MemoryStream compressedStream   = new MemoryStream(this.m_wwwConfigTable.bytes);
        MemoryStream uncompressedStream = new MemoryStream();

        CompressionUtility.DecompressStream(compressedStream, uncompressedStream);

        BinaryFormatter bft = new BinaryFormatter();

        DataResource.Resource = (DataSet)bft.Deserialize(uncompressedStream);

        /*
         * print(DataResource.Resource.Tables.Count);
         * print(DataResource.Resource.Tables[0].Rows.Count);
         * print(DataResource.Resource.Tables[1].Rows.Count);
         * print(DataResource.Resource.Tables[2].Rows.Count);
         */

        compressedStream.Close();
        uncompressedStream.Close();

        if (CommonHelper.PlatformType == ConfigUtilities.Enums.PlatformType.iOS &&
            Application.platform == RuntimePlatform.IPhonePlayer)
        {
            ((iOSShopUtility)(iOSShopUtility.Instance)).RequestProduct();
        }

        this.m_UserIntializer.StartInitialize();
    }