public MainViewModel() { this.selectedLanguage = CultureInfo.CurrentUICulture; // Initialize RadioFrequency enums using EnumWrapper explicitly this.RadioFrequencies = new EnumWrapperCollection<RadioFrequency>(); this.radioFrequency = this.RadioFrequencies.FirstOrDefault(); // Initialize PartyMode enum without EnumWrapper this.PartyModes = Enum.GetValues(typeof(PartyMode)).OfType<PartyMode>(); this.selectedPartyMode = this.PartyModes.FirstOrDefault(); this.EditCommand = new RelayCommand( () => { this.ChangeDate = DateTime.Now; this.IsEditing = true; }); this.CancelCommand = new RelayCommand( () => { this.IsEditing = false; }); this.NextPartyModeCommand = new RelayCommand( () => { // Cycle through PartyMode enum: this.SelectedPartyMode = (PartyMode)((int)(this.SelectedPartyMode + 1) % Enum.GetValues(this.SelectedPartyMode.GetType()).Length); }); }
public override void Handle(GameSession session, PacketReader packet) { PartyMode mode = (PartyMode)packet.ReadByte(); //Mode switch (mode) { case PartyMode.Invite: HandleInvite(session, packet); break; case PartyMode.Join: HandleJoin(session, packet); break; case PartyMode.Leave: HandleLeave(session); break; case PartyMode.Kick: HandleKick(session, packet); break; case PartyMode.SetLeader: HandleSetLeader(session, packet); break; case PartyMode.FinderJoin: HandleFinderJoin(session, packet); break; case PartyMode.SummonParty: HandleSummonParty(); break; case PartyMode.VoteKick: HandleVoteKick(session, packet); break; case PartyMode.ReadyCheck: HandleStartReadyCheck(session); break; case PartyMode.FindDungeonParty: HandleFindDungeonParty(session, packet); break; case PartyMode.ReadyCheckUpdate: HandleReadyCheckUpdate(session, packet); break; default: IPacketHandler <GameSession> .LogUnknownMode(mode); break; } }
//public int GetNumberOfPresentUnits() //{ // int value = 0; // // loop through all units in city garnizon // foreach (PartyUnit partyUnit in GetHeroPartyByMode(PartyMode.Garnizon).GetComponentsInChildren<PartyUnit>()) // { // // verify unit size // if (partyUnit.UnitSize == UnitSize.Double) // { // value += 2; // } // else // { // value += 1; // } // } // return value; //} public HeroParty GetHeroPartyByMode(PartyMode partyMode) { // Loop through hero parties untill we find the party in party not garnizon mode foreach (HeroParty heroParty in transform.GetComponentsInChildren <HeroParty>()) { // compare if hero party is in required mode if (heroParty.PartyMode == partyMode) { return(heroParty); } } return(null); }
public HeroPartyUI GetHeroPartyUIByMode(PartyMode partyMode, bool includeInactive = false) { // Loop through hero parties untill we find the party in required mode foreach (HeroPartyUI heroPartyUI in transform.GetComponentsInChildren <HeroPartyUI>(includeInactive)) { // compare if hero party in in party (not in garnizon mode) if (heroPartyUI.LHeroParty.PartyMode == partyMode) { return(heroPartyUI); } } return(null); }
public HeroParty GetHeroPartyByMode(PartyMode partyMode, bool includeInactive = false) { HeroPartyUI heroPartyUI = GetHeroPartyUIByMode(partyMode, includeInactive); if (heroPartyUI != null) { return(heroPartyUI.LHeroParty); } else { return(null); } }
static void Main(string[] args) { // /* 1 boton * SimpleInvoker SimpleInvoker = new SimpleInvoker(); * RoofLight RoofLight = new RoofLight(); * RoofLightOn RoofLightOn = new RoofLightOn(); * RoofLightOn.roofLight = RoofLight; * SimpleInvoker.SetCommand(RoofLightOn); * SimpleInvoker.PressButton();*/ ComplexInvoker ComplexInvoker = new ComplexInvoker(); RoofLight RoofLight = new RoofLight(); RoofLightOn RoofLightOn = new RoofLightOn(); RoofLightOn.RoofLight = RoofLight; RoofLightOff RoofLightOff = new RoofLightOff(); RoofLightOff.RoofLight = RoofLight; RoofLightDim RoofLightDim = new RoofLightDim(); RoofLightDim.RoofLight = RoofLight; Fan Fan = new Fan(); FanHigh FanHigh = new FanHigh(); FanHigh.Fan = Fan; FanMedium FanMedium = new FanMedium(); FanMedium.Fan = Fan; FanLow FanLow = new FanLow(); FanLow.Fan = Fan; FanOff FanOff = new FanOff(); FanOff.Fan = Fan; PartyMode PartyMode = new PartyMode(); PartyMode.CommandList.Add(FanHigh); PartyMode.CommandList.Add(RoofLightOn); //ComplexInvoker.SetCommand(RoofLightOn, 0); //ComplexInvoker.SetCommand(RoofLightOff, 1); //ComplexInvoker.SetCommand(RoofLightDim, 2); //ComplexInvoker.SetCommand(FanHigh, 3); //ComplexInvoker.SetCommand(FanMedium, 4); //ComplexInvoker.SetCommand(FanLow, 5); //ComplexInvoker.SetCommand(FanOff, 6); ComplexInvoker.SetCommand(PartyMode, 2); /*ComplexInvoker.PressButton(0); * ComplexInvoker.Undo(); * ComplexInvoker.PressButton(1); * ComplexInvoker.PressButton(2);*/ //ComplexInvoker.PressButton(3); //ComplexInvoker.PressButton(4); /*ComplexInvoker.Undo(); * ComplexInvoker.Undo();*/ ComplexInvoker.PressButton(2); ComplexInvoker.Undo(); //ComplexInvoker.PressButton(6); //ComplexInvoker.PressButton(5); //ComplexInvoker.PressButton(6); }