public void ListPlayStyles() { string reply = "Play styles available: "; foreach (object playstyleobject in playstyles) { IPlayStyle playstyle = playstyleobject as IPlayStyle; reply += playstyle.GetName() + ", "; } aicallback.SendTextMsg(reply, 0); aicallback.SendTextMsg(".csai chooseplaystyle <name> to choose", 0); }
public void RegisterPlayStyle(IPlayStyle playstyle) { if (!playstyles.Contains(playstyle)) { logfile.WriteLine("PlayStyleManager: registering playstyle " + playstyle.GetName()); playstyles.Add(playstyle); //if( playstyle.GetName().ToLower() == defaultplaystylename ) //{ // currentplaystyle = playstyle; // playstyle.Activate(); // } } }
public void ChoosePlayStyle(string playstylename) { IPlayStyle requestedstyle = null; foreach (object playstyleobject in playstyles) { IPlayStyle playstyle = playstyleobject as IPlayStyle; if (playstyle.GetName().ToLower() == playstylename.ToLower()) { requestedstyle = playstyle; } } if (requestedstyle != null) { aicallback.SendTextMsg("Activating play style " + requestedstyle.GetName(), 0); logfile.WriteLine("Activating play style " + requestedstyle.GetName()); } else { aicallback.SendTextMsg("Playstyle " + playstylename + " not found", 0); return; } foreach (object playstyleobject in playstyles) { IPlayStyle playstyle = playstyleobject as IPlayStyle; if (playstyle != requestedstyle) { playstyle.Disactivate(); } } requestedstyle.Activate(); currentplaystyle = requestedstyle; logfile.WriteLine("ChoosePlayStyle done"); }
public void RegisterPlayStyle( IPlayStyle playstyle ) { if( !playstyles.Contains( playstyle ) ) { logfile.WriteLine( "PlayStyleManager: registering playstyle " + playstyle.GetName() ); playstyles.Add( playstyle ); //if( playstyle.GetName().ToLower() == defaultplaystylename ) //{ // currentplaystyle = playstyle; // playstyle.Activate(); // } } }