public override void OnEngineMessage(InteropMessageID messageID, ScriptMessageReader mr) { switch (messageID) { case InteropMessageID.IMID_SCRIPT_OBJECT_RELEASE: this.RemoveObject(mr); break; case InteropMessageID.IMID_SCRIPT_OBJECTS_RELEASE: this.RemoveObjects(mr); break; case InteropMessageID.IMID_SCRIPT_SYNC_FLEET_POSITIONS: mr.ReadInteger(); int num = mr.ReadInteger(); for (int index = 0; index < num; ++index) { bool flag = mr.ReadBool(); this.App.GameDatabase.UpdateShipFleetPosition(mr.ReadInteger(), !flag ? new Vector3?() : new Vector3?(new Vector3(mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle()))); } if (!this._finalSync) { break; } this.App.SwitchGameState <StarMapState>(); break; } }
protected void RemoveObjects(ScriptMessageReader data) { for (int id = data.ReadInteger(); id != 0; id = data.ReadInteger()) { this.RemoveGameObject(this.App.GetGameObject(id)); } }
public void RemoveObjects(ScriptMessageReader data) { for (int id = data.ReadInteger(); id != 0; id = data.ReadInteger()) { IGameObject gameObject1 = this._set.Objects.FirstOrDefault <IGameObject>((Func <IGameObject, bool>)(x => { if (x.ObjectID == id) { return(x is IDisposable); } return(false); })); if (gameObject1 != null) { (gameObject1 as IDisposable).Dispose(); this._set.Remove(gameObject1); } else { IGameObject gameObject2 = this._app.GetGameObject(id); if (gameObject2 != null) { this._app.ReleaseObject(gameObject2); } } } }
public CombatData(ScriptMessageReader mr, int version) { this.Construct(); this._combatID = mr.ReadInteger(); this._systemID = mr.ReadInteger(); this._turn = mr.ReadInteger(); int num = mr.ReadInteger(); for (int index = 0; index < num; ++index) { this._data.Add(new PlayerCombatData(mr, version)); } }
public static DamagePattern Read(ScriptMessageReader r) { int width = r.ReadInteger(); int height = r.ReadInteger(); int originX = r.ReadInteger(); int originY = r.ReadInteger(); int size = DamagePattern.GetSize(DamagePattern.GetStride(width), height); byte[] initialData = new byte[size]; for (int index = 0; index < size; index += 4) { DamagePattern.FourCCToBytes((uint)r.ReadInteger(), out initialData[index], out initialData[index + 1], out initialData[index + 2], out initialData[index + 3]); } return(new DamagePattern(width, height, originX, originY, initialData)); }
public override void HandleScriptMessage(ScriptMessageReader mr) { switch ((Network.DialogAction)mr.ReadInteger()) { case Network.DialogAction.DA_FINALIZE: this._success = mr.ReadBool(); this.ShowButton(true); break; case Network.DialogAction.DA_NEWUSER_CREATING: this.AddDialogString(App.Localize("@NETWORKDIALOG_CREATE_NEW_USER")); break; case Network.DialogAction.DA_NEWUSER_INVALID_USERNAME: this.AddDialogString(App.Localize("@NETWORKDIALOG_INVALID_USERNAME")); break; case Network.DialogAction.DA_NEWUSER_NICK_IN_USE: this.AddDialogString("Nickname in use."); break; case Network.DialogAction.DA_NEWUSER_INVALID_PASSWORD: this.AddDialogString(App.Localize("@NETWORKDIALOG_INVALID_PASSWORD")); break; case Network.DialogAction.DA_NEWUSER_FAILED: this.AddDialogString(App.Localize("@NETWORKDIALOG_USER_CREATION_FAILED")); break; case Network.DialogAction.DA_NEWUSER_SUCCESS: this.AddDialogString(App.Localize("@NETWORKDIALOG_NEW_USER_CREATED")); break; } }
public override bool OnEngineMessage(InteropMessageID messageID, ScriptMessageReader message) { switch (messageID) { case InteropMessageID.IMID_SCRIPT_MANEUVER_INFO: this.m_CurrentPosition.X = message.ReadSingle(); this.m_CurrentPosition.Y = message.ReadSingle(); this.m_CurrentPosition.Z = message.ReadSingle(); this.m_Facing.X = message.ReadSingle(); this.m_Facing.Y = message.ReadSingle(); this.m_Facing.Z = message.ReadSingle(); this.HasReceivedAnUpdate = true; return(true); case InteropMessageID.IMID_SCRIPT_FORMATION_REMOVE_SHIP: int shipID = message.ReadInteger(); if (this._parentShipFormation != null) { this._parentShipFormation.RemoveShip(shipID); } return(true); default: App.Log.Warn("Unhandled message (id=" + (object)messageID + ") in FormationDefinition.", "combat"); return(false); } }
public override void HandleScriptMessage(ScriptMessageReader mr) { switch (mr.ReadInteger()) { case 0: this._success = mr.ReadBool(); this.ShowButton(true); break; case 2: this.AddDialogString(App.Localize("@GAMESPY_CONNECTING")); break; case 3: this.AddDialogString(App.Localize("@GAMESPY_CONNECT_FAILED")); break; case 4: this.AddDialogString(App.Localize("@GAMESPY_INVALID_PASS")); break; case 5: this.AddDialogString(App.Localize("@INVALID_USERNAME_TEXT")); break; case 9: this.AddDialogString(App.Localize("@GAMESPY_CONNECT_CHAT_FAILED")); break; case 10: this.AddDialogString(App.Localize("@GAMESPY_CONNECTED")); break; } }
public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message) { InteropMessageID interopMessageId = messageId; if (messageId == InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP) { if (message.ReadString() == "BeamFinished") { this.m_Finished = true; this.m_Succeeded = message.ReadInteger() == 1; this.m_Resources = message.ReadInteger(); } return(true); } App.Log.Warn("Unhandled message (id=" + (object)interopMessageId + ").", "combat"); return(base.OnEngineMessage(messageId, message)); }
public void AddObject(ScriptMessageReader data) { InteropGameObjectType interopGameObjectType = (InteropGameObjectType)data.ReadInteger(); IGameObject gameObject = (IGameObject)null; if (gameObject == null) { return; } this._postLoadedObjects.Add(gameObject); }
public override void OnEngineMessage(InteropMessageID messageID, ScriptMessageReader mr) { if (messageID == InteropMessageID.IMID_SCRIPT_MOVE_ORDER) { if (this.GetCommanderForPlayerID(mr.ReadInteger()) == null) { ; } } else { base.OnEngineMessage(messageID, mr); } }
public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message) { switch (messageId) { case InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP: string str = message.ReadString(); if (str == "Position") { this._position = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle()); return(true); } if (str == "ShipSpeedScale") { this._shipSpeedState = (ShipSpeedState)message.ReadInteger(); return(true); } if (str == "TargetFacingAngle") { this._targetFacingAngle = (TargetFacingAngle)message.ReadInteger(); return(true); } break; case InteropMessageID.IMID_SCRIPT_MANEUVER_INFO: this._position = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle()); this._rotation = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle()); this._velocity = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle()); this._destination = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle()); return(true); default: App.Log.Warn("Unhandled message (id=" + (object)messageId + ").", "combat"); break; } return(false); }
public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message) { if (messageId == InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP) { if (message.ReadString() == "PlanetPopUpdate") { this.Population = message.ReadDouble(); this._lastAttackingObject = this.App.GetGameObject(message.ReadInteger()); return(true); } } else { App.Log.Warn("Unhandled message (id=" + (object)messageId + ").", "game"); } return(false); }
public override void HandleScriptMessage(ScriptMessageReader mr) { switch ((Network.DialogAction)mr.ReadInteger()) { case Network.DialogAction.DA_FINALIZE: this._success = mr.ReadBool(); this._app.UI.CloseDialog((Dialog)this, true); break; case Network.DialogAction.DA_RAW_STRING: this.AddString(mr.ReadString()); break; case Network.DialogAction.DA_CONNECT_CONNECTING: this.AddString("Connecting to Host."); break; case Network.DialogAction.DA_CONNECT_FAILED: this.AddString("Failed to connect to Host."); break; case Network.DialogAction.DA_CONNECT_SUCCESS: this.AddString("Connection to Host succeeded."); break; case Network.DialogAction.DA_CONNECT_TIMED_OUT: this.AddString("Connection to Host timed out."); break; case Network.DialogAction.DA_CONNECT_INVALID_PASSWORD: this.AddString("Invalid password."); break; case Network.DialogAction.DA_CONNECT_NAT_FAILURE: this.AddString("NAT Negotiation failed."); break; } }
public override void OnEngineMessage(InteropMessageID messageID, ScriptMessageReader mr) { switch (messageID) { case InteropMessageID.IMID_SCRIPT_SYNC_DEFENSE_POSITIONS: int num1 = mr.ReadInteger(); for (int index1 = 0; index1 < num1; ++index1) { mr.ReadInteger(); int num2 = mr.ReadInteger(); for (int index2 = 0; index2 < num2; ++index2) { if (mr.ReadBool()) { bool flag = mr.ReadBool(); this.App.GameDatabase.UpdateShipSystemPosition(mr.ReadInteger(), !flag ? new Matrix?() : new Matrix?(new Matrix(mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle()))); } } } if (this._finishing) { this.App.SwitchGameState <StarMapState>(); break; } break; case InteropMessageID.IMID_SCRIPT_SYNC_DEFENSEBOAT_DATA: int shipID = mr.ReadInteger(); int OrbitalID = mr.ReadInteger(); this.App.GameDatabase.RemoveSDBByShipID(shipID); if (OrbitalID != 0) { this.App.GameDatabase.InsertSDB(OrbitalID, shipID); break; } break; } base.OnEngineMessage(messageID, mr); }
public PlayerCombatData(ScriptMessageReader mr, int version) { this._playerID = mr.ReadInteger(); this._victoryStatus = (GameSession.VictoryStatus)mr.ReadInteger(); this.Construct(); int num1 = mr.ReadInteger(); for (int index = 0; index < num1; ++index) { this._shipData.Add(new Kerberos.Sots.Strategy.ShipData() { designID = mr.ReadInteger(), damageDealt = mr.ReadSingle(), damageReceived = mr.ReadSingle(), killCount = mr.ReadInteger(), destroyed = mr.ReadBool() }); } int num2 = mr.ReadInteger(); for (int index1 = 0; index1 < num2; ++index1) { Kerberos.Sots.Strategy.PlanetData planetData = new Kerberos.Sots.Strategy.PlanetData(); planetData.orbitalObjectID = mr.ReadInteger(); planetData.imperialDamage = mr.ReadDouble(); int num3 = mr.ReadInteger(); planetData.civilianDamage = new List <PopulationData>(); for (int index2 = 0; index2 < num3; ++index2) { PopulationData populationData = new PopulationData() { faction = mr.ReadString(), damage = mr.ReadDouble() }; } planetData.infrastructureDamage = mr.ReadSingle(); planetData.terraDamage = mr.ReadSingle(); this._planetData.Add(planetData); } int num4 = mr.ReadInteger(); for (int index = 0; index < num4; ++index) { this._weaponData.Add(new Kerberos.Sots.Strategy.WeaponData() { weaponID = mr.ReadInteger(), damageDealt = mr.ReadSingle() }); } if (version >= 1) { this._fleetCount = mr.ReadInteger(); } else { this._fleetCount = 0; } }
protected void RemoveObject(ScriptMessageReader data) { this.RemoveGameObject(this.App.GetGameObject(data.ReadInteger())); }