private void HandleServerEventMultiplayerOptionsImmediate(MultiplayerOptionsImmediate message) { for (MultiplayerOptions.OptionType optionType = MultiplayerOptions.OptionType.ServerName; optionType < MultiplayerOptions.OptionType.NumOfSlots; ++optionType) { MultiplayerOptionsProperty optionProperty = optionType.GetOptionProperty(); if (optionProperty.Replication == MultiplayerOptionsProperty.ReplicationOccurrence.Immediately) { switch (optionProperty.OptionValueType) { case MultiplayerOptions.OptionValueType.Bool: bool flag; message.GetOption(optionType).GetValue(out flag); optionType.SetValue(flag); continue; case MultiplayerOptions.OptionValueType.Integer: case MultiplayerOptions.OptionValueType.Enum: int num; message.GetOption(optionType).GetValue(out num); optionType.SetValue(num); continue; case MultiplayerOptions.OptionValueType.String: string str; message.GetOption(optionType).GetValue(out str); optionType.SetValue(str); continue; default: throw new ArgumentOutOfRangeException(); } } } }
private void HandleServerEventMultiplayerOptionsInitial(MultiplayerOptionsInitial message) { for (MultiplayerOptions.OptionType optionType = MultiplayerOptions.OptionType.ServerName; optionType < MultiplayerOptions.OptionType.NumOfSlots; ++optionType) { MultiplayerOptionsProperty optionProperty = optionType.GetOptionProperty(); if (optionProperty.Replication == MultiplayerOptionsProperty.ReplicationOccurrence.AtMapLoad) { switch (optionProperty.OptionValueType) { case MultiplayerOptions.OptionValueType.Bool: bool flag; message.GetOption(optionType).GetValue(out flag); optionType.SetValue(flag); continue; case MultiplayerOptions.OptionValueType.Integer: case MultiplayerOptions.OptionValueType.Enum: int num; message.GetOption(optionType).GetValue(out num); optionType.SetValue(num); continue; case MultiplayerOptions.OptionValueType.String: string str; message.GetOption(optionType).GetValue(out str); optionType.SetValue(str); continue; default: throw new ArgumentOutOfRangeException(); } } } string strValue = MultiplayerOptions.OptionType.WelcomeMessage.GetStrValue(); if (string.IsNullOrEmpty(strValue)) { return; } BaseNetworkComponent.WelcomeMessageReceivedDelegate welcomeMessageReceived = this.WelcomeMessageReceived; if (welcomeMessageReceived == null) { return; } welcomeMessageReceived(strValue); }
public string GetValueTextForOptionWithMultipleSelection( MultiplayerOptions.OptionType optionType) { MultiplayerOptionsProperty optionProperty = optionType.GetOptionProperty(); switch (optionProperty.OptionValueType) { case MultiplayerOptions.OptionValueType.Enum: return(Enum.ToObject(optionProperty.EnumType, optionType.GetIntValue()).ToString()); case MultiplayerOptions.OptionValueType.String: return(optionType.GetStrValue()); default: return((string)null); } }
public void SetValueForOptionWithMultipleSelectionFromText( MultiplayerOptions.OptionType optionType, string value) { MultiplayerOptionsProperty optionProperty = optionType.GetOptionProperty(); switch (optionProperty.OptionValueType) { case MultiplayerOptions.OptionValueType.Enum: optionType.SetValue((int)Enum.Parse(optionProperty.EnumType, value)); break; case MultiplayerOptions.OptionValueType.String: optionType.SetValue(value); break; } if (optionType != MultiplayerOptions.OptionType.GameType && optionType != MultiplayerOptions.OptionType.ClanMatchType) { return; } this.OnGameTypeChanged(); }