public NetworkManager() { m_NetworkLog = new NetworkLog(); m_Client = new HClient(); m_Client.OnAccountResponse += M_Client_OnAccountResponse; m_Client.OnGameDataResponse += M_Client_OnGameDataResponse; m_Client.OnTowerDataResponse += M_Client_OnTowerDataResponse; m_ClientPump = new Thread(new ThreadStart(ClientPumpThread)); m_ClientPump.Name = "Client Pump Thread"; m_ClientPump.Start(); m_SignInStatus = SignInStatus.None; if (m_VipData == null) { m_VipData = new VipDataArgs(); m_VipData.Level = 1; m_VipData.Progress = 0; m_VipData.Hints = 5; m_VipData.MegaHints = 2; m_VipData.UndoSize = 5; } }
public void LoadStaticData() { GameDataArgs gd = new GameDataArgs(); gd.TowerFloors = new int[6]; // Load game data if it exists if (File.Exists(s_GameDataFile)) { FileStream fs = File.OpenRead(s_GameDataFile); BinaryReader br = new BinaryReader(fs); int version = br.ReadInt32(); int towers = version == 1 ? 4 : gd.TowerFloors.Length; for (int i = 0; i < towers; i++) gd.TowerFloors[i] = br.ReadInt32(); gd.Level = br.ReadInt32(); gd.Exp = br.ReadInt32(); gd.Tutorial = br.ReadUInt32(); m_Client.HardCurrency = br.ReadInt32(); br.Close(); } else { gd.TowerFloors[0] = 1; gd.TowerFloors[1] = 0; gd.TowerFloors[2] = 0; gd.TowerFloors[3] = 0; gd.TowerFloors[4] = 0; gd.TowerFloors[5] = 0; gd.Level = 1; gd.Exp = 0; gd.Tutorial = 0; m_Client.HardCurrency = 1000; } m_GameData = gd; if (m_VipData == null) { m_VipData = new VipDataArgs(); m_VipData.Level = 1; m_VipData.Progress = 0; m_VipData.Hints = 5; m_VipData.MegaHints = 2; m_VipData.UndoSize = 5; } }
protected override void WriteVipData(int vipPoints) { VipDataArgs vip = OnBuildVipDataArgs.Invoke(vipPoints); vip.Write(_outgoingBW); }
protected override void ReadVipData(BinaryReader br) { base.ReadVipData(br); VipInfo = new VipDataArgs(); VipInfo.Read(br); }
void LoadVipData(BinaryReader br, int version) { _vipData = new VipDataArgs(); _vipData.Read(br, version); }