Exemplo n.º 1
0
    public IEnumerator LoadGameConfigure()
    {
        FileStream    fs         = new FileStream(GameDataCenter.GetGameConfigureFilePath(), FileMode.Open);
        XmlSerializer serializer = new XmlSerializer(typeof(GameConfigure));

        gameConfigure = (GameConfigure)serializer.Deserialize(fs);

        yield return(0);
    }
    public void Save()
    {
        string        data       = "";
        XmlSerializer serializer = new XmlSerializer(typeof(List <MJumpTube>));
        StringWriter  textWriter = new StringWriter();

        serializer.Serialize(textWriter, jumptubes);
        data = textWriter.ToString();
        GameDataCenter.WriteDataToFile(data, GameDataCenter.GetSpecialAttributeFilePath(DataFileName.JumpTubes));
    }
Exemplo n.º 3
0
        public void CloseSocket()
        {
            MonoBehaviour.print("close socket" + this.GetSessionID());
            if (netSocket != null && GameDataCenter.GetInstance().SocketReset != 1)
            {
                GameDataCenter.GetInstance().SocketReset = 1;

                netSocket.Shutdown(SocketShutdown.Both);
                netSocket.Close();
                netSocket = null;
            }
        }
Exemplo n.º 4
0
    /*
     * public void LoadGameWorlds(MonoBehaviour mono, LoadDataOverCallback callback = null){
     *  mono.StartCoroutine( LoadGameWorlds( callback ) );
     * }
     */



    public IEnumerator LoadGameWorlds( )
    {
        gameWorlds.Clear();
        for (int i = 1; i <= 25; ++i)
        {
            FileStream    fs         = new FileStream(GameDataCenter.GetGameWorldFilePath(i), FileMode.Open);
            XmlSerializer serializer = new XmlSerializer(typeof(MGameWorld));
            MGameWorld    world      = (MGameWorld)serializer.Deserialize(fs);
            gameWorlds.Add(world);
        }

        yield return(0);
    }
Exemplo n.º 5
0
 public static void SendNetMessage(string head, Dictionary <string, object> dataList)
 {
     print("send message:" + head);
     if (netSession == null)
     {
         //gameGlobal.g_tipOneButtom.Show(gameGlobal.GetStr(1024));
         return;
     }
     netSession.SendMessage(head, dataList);
     //gameGlobal.g_LoadingPage.show();
     if (GameDataCenter.GetInstance().heartTime != null)
     {
         heart_beat = GameDataCenter.GetInstance().heartTime;
     }
 }
Exemplo n.º 6
0
        void Start()
        {
            if (!GameDataCenter.instance.isSdkLogin)
            {
                PlatformProxy.instance.ShowSdkLogin(PayCallbackData.GetPayCallbackDataByID(100).callback);
            }
            else
            {
                GameDataCenter gdc = GameDataCenter.instance;
                LoginSuccessHandler(gdc.sdkId, gdc.u8id, gdc.token, gdc.platformId);
            }
#if UNITY_ANDROID && !UNITY_EDITOR
            StartCoroutine(ShowNoticeView());
#elif UNITY_IOS && !UNITY_EDITOR
            StartCoroutine(ShowNoticeView());
#endif
        }
    public IEnumerator Load()
    {
        WWW www = new WWW(GameDataCenter.GetSpecialAttributeFilePath(DataFileName.JumpTubes));

        yield return(www);

        if (www.error != null)
        {
            Debug.LogError("Load " + DataFileName.JumpTubes + " error!!");
        }
        else
        {
            TextReader    fs         = new StringReader(www.text);
            XmlSerializer serializer = new XmlSerializer(typeof(List <MJumpTube>));
            jumptubes = (List <MJumpTube>)serializer.Deserialize(fs);
            fs.Close();
        }
    }
Exemplo n.º 8
0
    void Reconnect()
    {
        bool connectRet = InitNetWork();

        print("reconnect :" + connectRet);
        if (connectRet == false)
        {
            Invoke("Reconnect", 2.0f);
        }
        else if (connectRet == true)
        {
            //GameMessgeHandle.MessageRegister.RegisterMessage();
            //Dictionary<string,object> dic =  new Dictionary<string, object>();
            //dic.Add("userId",GameDataCenter.GetInstance().userLoginData.userDto.userId);
            //dic.Add("playerId",GameDataCenter.GetInstance().playerData.playerId);
            //SendNetMessage(LoginMessageRegister.COMMON_RESET_LOGIN,dic);

            GameDataCenter.GetInstance().SocketReset = 2;
        }
    }
Exemplo n.º 9
0
 public static void SendNoReturnNetMessage(string head, Dictionary <string, object> dataList)
 {
     print("send message:" + head);
     netSession.SendMessage(head, dataList);
     heart_beat = GameDataCenter.GetInstance().heartTime;
 }