private void Swiped (Phases phase, List<MotionInfo> moveInfos) { if (phase != Phases.Stationary && phase != Phases.Ended) return; averageSpeed = getAverageSpeed (moveInfos); averageDirection = getAverageDirection (moveInfos); isForceResidue = true; }
/// <summary> /// @Author: Andrew Seba /// Increments the phase to next ENUM; /// </summary> public void NextPhase() { curPhaseIndex = (curPhaseIndex + 1) % ROTATE; phase = (Phases)curPhaseIndex; switch (phase) { case (Phases.GAMESTART): if(turnNumber > 0) { //skip phase SetPhase("ROLL"); break; } break; case (Phases.ROLL): break; case (Phases.TRADE): break; case (Phases.BUILD): break; case (Phases.PROCESS): break; case (Phases.ENDGAME): turnNumber++; break; } UpdateText(); }
public GUITexture this[Phases phase] { get { return this.phases[(int)phase]; } }
// Use this for initialization void Start() { actualPhase = Phases.ludus; mainCamera = Camera.main; inputer = GameObject.FindWithTag("INPUTER").GetComponent<XInput>(); player = GameObject.FindWithTag ("Player"); }
public void ReceiveInput(ButtonSimon.ButtonColor color) { if (currentPhase == Phases.waiting) { if (colorsToEnter[indexTry] == color) { indexTry++; timeToShow = 0f; if (indexTry == number) { number++; if (number == numberIteration + 1) { currentPhase = Phases.ended; endedLed.GetComponent<Image>().color = new Color(1f, 1f, 0f); theBomb.GetComponent<Bomb>().FinishedSimon(); return; } else { indexTry = 0; currentPhase = Phases.showing; StartCoroutine(ShowColor()); } } } else { theBomb.GetComponent<Bomb>().AddError(); } } }
/// <summary> /// Loads everything async. /// - User Login to the Server (and sets the Account) /// - Loads the definitions (unit and terrain) /// - Loads regions at the current Geo Location. /// </summary> /// <returns>The account async.</returns> public async Task<Core.Models.Account> InitLoadingAsync() { // wait until there is an known position await Geolocation.Instance.GetPositionAsync(); Phase = Phases.PositionAquired; var account = await LoginAsync(); if (account != null) { Phase = Phases.LoggedIn; var controller = Core.Controllers.Controller.Instance; // adds his own account to AccountManager, so it is known Core.Models.World.Instance.AccountManager.AddAccount(account); var entityManagerController = controller.DefinitionManagerController as Client.Common.Manager.DefinitionManagerController; await entityManagerController.LoadTerrainDefinitionsAsync(); Phase = Phases.TerrainTypeLoaded; await entityManagerController.LoadUnitDefinitionsAsync(); Phase = Phases.EntityTypeLoaded; // do something in the future Phase = Phases.Done; } else { Phase = Phases.Failure; throw new NotImplementedException("Login failure"); } return account; }
public void SkipToPhase(Phases phase) { if (((int)phase) <= ((int)curPhase)) return; prioritiesHasBeenReset = false; skipToPhase = phase; shouldSkipToPhase = true; CheckIfShouldSkip(); }
public PhaseSkipToController(GuiInformation guiinfo, Player owner) { // TODO: Complete member initialization this.guiinfo = guiinfo; this.owner = owner; owner.EventManager.Register(new Trigger<PlayersTurnChangedEvent>(evt => { currentPlayersTurn = evt.PlayersTurn; shouldSkipToPhase = false; })); owner.EventManager.Register(new Trigger<PhaseChangedEvent>(evt => { lastGainPrio = null; prioritiesHasBeenReset = false; curPhase = evt.NewPhase; })); owner.EventManager.Register(new Trigger<PlayerGainedPriorityEvent>(this.OnPlayerGainPriority)); owner.EventManager.Register(new Trigger<ResetPrioritiesEvent>(evt => prioritiesHasBeenReset = true)); }
/// <summary> /// Initializes a new instance of the <see cref="Client.Common.Views.StartScene"/> class. /// </summary> /// <param name="mainWindow">Main window.</param> public StartScene(CCWindow mainWindow) : base(mainWindow) { Phase = Phases.Start; m_logoLayer = new LogoLayer(this); this.AddChild(m_logoLayer); InitWorld(); }
private void Awake () { GameObject go = GameObject.Find ("MobileObject"); if (go == null) { Debug.Log ("GameControl: Can't find MobileObject."); return; } phase = Phases.Ended; mObject = go.AddComponent<MobileObject> (); cam = Camera.main; moveInfo = new List<MotionInfo> (); }
/// <summary> /// @Author: Andrew Seba /// Increments the phase to next ENUM; /// </summary> public void NextPhase() { curPhaseIndex = (curPhaseIndex + 1) % ROTATE; phase = (Phases)curPhaseIndex; //A system, to change phase to the appropriate phase switch (phase) { case (Phases.GAMESTART): if(turnNumber > 0) { //skip phase SetPhase("ROLL"); break; } else SetPhase("GAMESTART"); break; case (Phases.ROLL): SetPhase("ROLL"); break; case (Phases.TRADE): SetPhase("TRADE"); break; case (Phases.BUILD): SetPhase("BUILD"); break; case (Phases.PROCESS): turnNumber++; SetPhase("ENDGAME"); break; case (Phases.ENDGAME): //if(game is over) //move to appropriate game over screen //else //SetPhase("ROLL"); break; } UpdateText(); }
/// <summary> /// @Author: Andrew Seba /// Increments the phase to next ENUM; /// </summary> public void NextPhase() { curPhaseIndex = (curPhaseIndex + 1) % ROTATE; phase = (Phases)curPhaseIndex; switch (phase) { case (Phases.GAMESTART): if (turnNumber > 0) { //skip phase SetPhase("ROLL"); break; } else { //gipson //load map info (Default for now) GetComponent<Map>().LoadMap(); //give player single build phase } break; case (Phases.ROLL): //gipson //erase information from last turn int roll = Random.Range(1,6); //find all nodes with roll as activation //find settlements on nodes //add resource of type to player break; case (Phases.TRADE): break; case (Phases.BUILD): break; case (Phases.PROCESS): break; case (Phases.ENDGAME): turnNumber++; break; } UpdateText(); }
void CheckBack() { if (inputed == false) { if (actualPhase == Phases.ludus && inputer.BACK == true) { actualPhase = Phases.arena; player.transform.position = new Vector3(0.0f,2.0f,0.0f); player.transform.rotation = Quaternion.FromToRotation(Vector3.left, transform.forward); mainCamera.transform.localPosition = behindPlayer; inputed = true; }else{ if (actualPhase == Phases.arena && inputer.BACK == true) { actualPhase = Phases.ludus; mainCamera.transform.localPosition = frontPlayer; inputed = true; } } } else { if(inputer.BACK == false){ inputed = false; } } }
protected void StartSelectTemplateSubphase(object sender, System.EventArgs e) { BarrelRollDirectionDecisionSubPhase selectBarrelRollTemplate = (BarrelRollDirectionDecisionSubPhase)Phases.StartTemporarySubPhaseNew( Name, typeof(BarrelRollDirectionDecisionSubPhase), Triggers.FinishTrigger ); foreach (var template in availableTemplates) { switch (template) { case Actions.BarrelRollTemplates.Straight1: selectBarrelRollTemplate.AddDecision("Left Straight 1", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight1Left); DecisionSubPhase.ConfirmDecision(); }); selectBarrelRollTemplate.AddDecision("Right Straight 1", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight1Right); DecisionSubPhase.ConfirmDecision(); }); break; case Actions.BarrelRollTemplates.Bank1: selectBarrelRollTemplate.AddDecision("Left Bank 1 Forward", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1LeftForward); DecisionSubPhase.ConfirmDecision(); }); selectBarrelRollTemplate.AddDecision("Right Bank 1 Forward", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1RightForward); DecisionSubPhase.ConfirmDecision(); }); selectBarrelRollTemplate.AddDecision("Left Bank 1 Backwards", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1LeftBackwards); DecisionSubPhase.ConfirmDecision(); }); selectBarrelRollTemplate.AddDecision("Right Bank 1 Backwards", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1RightBackwards); DecisionSubPhase.ConfirmDecision(); }); break; case Actions.BarrelRollTemplates.Straight2: selectBarrelRollTemplate.AddDecision("Left Straight 2", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight2Left); DecisionSubPhase.ConfirmDecision(); }); selectBarrelRollTemplate.AddDecision("Right Straight 2", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight2Right); DecisionSubPhase.ConfirmDecision(); }); break; default: break; } } selectBarrelRollTemplate.InfoText = "Barrel Roll: Select template and direction"; selectBarrelRollTemplate.DefaultDecisionName = selectBarrelRollTemplate.GetDecisions().First().Name; selectBarrelRollTemplate.RequiredPlayer = Controller.PlayerNo; selectBarrelRollTemplate.Start(); }
private void Finish() { Phases.FinishSubPhase(this.GetType()); CallBack(); }
private void FinishAction() { Phases.FinishSubPhase(typeof(BombLaunchPlanningSubPhase)); CallBack(); }
private void ConfirmDecision() { Phases.FinishSubPhase(this.GetType()); CallBack(); }
private void ShowPilotCrits() { SelectPilotCritDecision selectPilotCritSubphase = (SelectPilotCritDecision)Phases.StartTemporarySubPhaseNew( "Select Damage Card", typeof(SelectPilotCritDecision), Triggers.FinishTrigger ); List <GenericDamageCard> opponentDeck = DamageDecks.GetDamageDeck(Roster.AnotherPlayer(HostShip.Owner.PlayerNo)).Deck; foreach (var card in opponentDeck.Where(n => n.Type == CriticalCardType.Pilot)) { Decision existingDecision = selectPilotCritSubphase.GetDecisions().Find(n => n.Name == card.Name); if (existingDecision == null) { selectPilotCritSubphase.AddDecision(card.Name, delegate { SelectDamageCard(card); }, card.ImageUrl, 1); } else { existingDecision.SetCount(existingDecision.Count + 1); } } selectPilotCritSubphase.DecisionViewType = DecisionViewTypes.ImageButtons; selectPilotCritSubphase.DefaultDecisionName = selectPilotCritSubphase.GetDecisions().First().Name; selectPilotCritSubphase.InfoText = "Kylo Ren: Select Damage Card"; selectPilotCritSubphase.RequiredPlayer = HostShip.Owner.PlayerNo; selectPilotCritSubphase.Start(); }
void Update() { if(Input.GetKeyUp(KeyCode.Escape)) Application.Quit(); switch (phase) { case Phases.Waiting: if(Input.GetKeyUp(KeyCode.N)) phase = nextPhase; break; case Phases.Placement: { lastPhase = Phases.Placement; if(godIndex == gods.Length || Input.GetKeyUp(KeyCode.N)) { nextPhase = Phases.Reproduction; phase = Phases.Waiting; } else { if(landscape.selectedBlock != null) { Debug.Log("Placing population for god " + gods[godIndex]); for (int i = 0; i < startingPopulation; i++) { //Give the population a god var age = Random.Range(2, 4); var newPop = MakePopulation(gods[godIndex], age); landscape.selectedBlock.AddPopulation(newPop); } godIndex++; landscape.selectedBlock = null; } } } break; case Phases.Reproduction: { lastPhase = Phases.Reproduction; Reproduction(); phase = Phases.Waiting; nextPhase = Phases.Migration; } break; case Phases.Migration: { lastPhase = Phases.Migration; Migration(); phase = Phases.Waiting; nextPhase = Phases.Conflict; } break; case Phases.Conflict: { lastPhase = Phases.Conflict; Conflict(); phase = Phases.Waiting; nextPhase = Phases.Conversion; } break; case Phases.Conversion: { lastPhase = Phases.Conversion; Conversion(); phase = Phases.Waiting; nextPhase = Phases.Aging; } break; case Phases.Aging: { lastPhase = Phases.Aging; Aging(); if(++turn <= turnsInGame) { phase = Phases.Waiting; nextPhase = Phases.Reproduction; } else { Debug.Log("Game Over"); phase = Phases.GameOver; } } break; case Phases.GameOver: lastPhase = Phases.GameOver; break; default: break; } }
private static void RunDecisionSubPhase() { Phases.StartTemporarySubPhaseOld("Triggers Order", typeof(TriggersOrderSubPhase)); }
public bool HasPhase(uint phaseId) { return(Phases.ContainsKey(phaseId)); }
void ReceiverRunClientWrapper() { try { ReceiverRunClient(); } catch (ThreadInterruptedException) { return; } #if !DEBUG catch (Exception e) { Log.Write(e, this); } #endif finally { #if DEBUG Console.WriteLine("ClientReceiver Ended: " + this); #endif clientThread.State = "Finally closing down 0"; Phase = Phases.FinalClose; SetWorld(World.Void); clientThread.State = "Finally closing down 1"; SaveProxyPlayer(); clientThread.State = "Finally closing down 2"; PlayerList.LogoutPlayer(this); clientThread.State = "Finally closing down 3"; RegionCrossing.ClearRegion(this); clientThread.State = "Finally closing down 4"; socket.Close(); clientThread.State = "Finally closing down 5"; //clientStream.Flush(); clientStream.Close(); clientThread.State = "Finally closing down -all done"; } }
public void ChooseTargetToAcquireTargetLock(Action callback, string abilityName, IImageHolder imageSource) { AcquireTargetLockSubPhase selectTargetLockSubPhase = (AcquireTargetLockSubPhase)Phases.StartTemporarySubPhaseNew( "Select target for Target Lock", typeof(AcquireTargetLockSubPhase), delegate { UI.HideSkipButton(); Phases.FinishSubPhase(typeof(AcquireTargetLockSubPhase)); callback(); }); selectTargetLockSubPhase.RequiredPlayer = Owner.PlayerNo; selectTargetLockSubPhase.DescriptionShort = abilityName; selectTargetLockSubPhase.ImageSource = imageSource; selectTargetLockSubPhase.Start(); }
public virtual void Close(string message) { if (Queue != null) Queue.Dispose(); SetWorld(World.Void); Log.WritePlayer(this, "Client Closed: " + message); if (Phase == Phases.Handshake) SendToClient(new DisconnectHandshake(message)); else SendToClient(new Disconnect(message)); Phase = Phases.FinalClose; clientStream.Flush(); clientStream.Close(); }
/// <summary> /// Uses the string parameter to Set phase directly. /// </summary> /// <param name="pPhase"></param> public void SetPhase(string pPhase) { pPhase = pPhase.ToUpper(); switch (pPhase) { case ("GAMESTART"): phase = Phases.GAMESTART; Debug.Log ("Doing game start things..."); break; case ("ROLL"): phase = Phases.ROLL; Debug.Log ("Doing roll things..."); break; case ("TRADE"): phase = Phases.TRADE; Debug.Log ("Doing Trade things..."); break; case ("BUILD"): phase = Phases.BUILD; Debug.Log ("Doing build things..."); break; case ("PROCESS"): phase = Phases.PROCESS; break; case ("ENDGAME"): phase = Phases.ENDGAME; break; } curPhaseIndex = (int)phase.GetTypeCode(); }
public PhaseChangedEvent(Phases oldphase, Phases newPhase) { this.oldphase = oldphase; this.newPhase = newPhase; }
public void StartBarrelRollExecution() { Pause(); TheShip.ToggleShipStandAndPeg(false); BarrelRollTemplate.SetActive(false); BarrelRollExecutionSubPhase executionSubphase = (BarrelRollExecutionSubPhase)Phases.StartTemporarySubPhaseNew( "Barrel Roll execution", typeof(BarrelRollExecutionSubPhase), CallBack ); executionSubphase.TheShip = TheShip; executionSubphase.TemporaryShipBase = TemporaryShipBase; executionSubphase.HelperDirection = HelperDirection; executionSubphase.IsTractorBeamBarrelRoll = IsTractorBeamBarrelRoll; executionSubphase.Start(); }
public void SetPhaseColor(Phases phase, Color color) { //Debug.Log("GUI VIEW PHASE CHANGED: " + phase+" to color "+color); this[phase].color = color; }
private void Finish() { UI.HideSkipButton(); Phases.FinishSubPhase(typeof(ActionDecisonSubPhase)); Triggers.FinishTrigger(); }
public static void SelectObstacleNoCallback() { Phases.FinishSubPhase(Phases.CurrentSubPhase.GetType()); //Phases.CurrentSubPhase.Resume(); }
public override void ReturnToMainMenu() { Phases.EndGame(); SceneManager.LoadScene("MainMenu"); }
private void StartQuestionSubphase(object sender, System.EventArgs e) { MirandaDoniDecisionSubPhase selectMirandaDoniSubPhase = (MirandaDoniDecisionSubPhase)Phases.StartTemporarySubPhaseNew( Name, typeof(MirandaDoniDecisionSubPhase), Triggers.FinishTrigger ); selectMirandaDoniSubPhase.InfoText = "Use " + Name + "?"; if (HostShip.Shields > 0) { selectMirandaDoniSubPhase.AddDecision("Spend 1 shield to roll 1 extra die", RegisterRollExtraDice); selectMirandaDoniSubPhase.AddTooltip("Spend 1 shield to roll 1 extra die", HostShip.ImageUrl); } if (HostShip.Shields < HostShip.MaxShields) { selectMirandaDoniSubPhase.AddDecision("Roll 1 fewer die to recover 1 shield", RegisterRegeneration); selectMirandaDoniSubPhase.AddTooltip("Roll 1 fewer die to recover 1 shield", HostShip.ImageUrl); } selectMirandaDoniSubPhase.AddDecision("No", delegate { DecisionSubPhase.ConfirmDecision(); }); selectMirandaDoniSubPhase.DefaultDecisionName = GetDefaultDecision(); selectMirandaDoniSubPhase.ShowSkipButton = true; selectMirandaDoniSubPhase.Start(); }
public BudgetRecord(Phases currentPhase, BudgetType budgetType, int MoneyAmount) { this.Phase = currentPhase; this.BudgetType = budgetType; this.MoneyAmount = MoneyAmount; }
protected void UpdateHelpInfo() { Phases.UpdateHelpInfo(); }
public override void SkipButton() { Phases.FinishSubPhase(typeof(SelectTargetForSecondAttackSubPhase)); Triggers.FinishTrigger(); }
public override void Initialize() { InformAboutNewRoundStart(); Phases.Events.CallRoundStartTrigger(delegate { Phases.FinishSubPhase(this.GetType()); }); }
private void StartSelectTemplateDecision(object sender, System.EventArgs e) { SelectBombLaunchTemplateDecisionSubPhase selectBoostTemplateDecisionSubPhase = (SelectBombLaunchTemplateDecisionSubPhase)Phases.StartTemporarySubPhaseNew( "Select template to launch the bomb", typeof(SelectBombLaunchTemplateDecisionSubPhase), Triggers.FinishTrigger ); selectBoostTemplateDecisionSubPhase.ShowSkipButton = false; foreach (var bombDropTemplate in AvailableBombLaunchTemplates) { selectBoostTemplateDecisionSubPhase.AddDecision( bombDropTemplate.Name, delegate { SelectTemplate(bombDropTemplate); }, isCentered: (bombDropTemplate.Direction == Movement.ManeuverDirection.Forward) ); } selectBoostTemplateDecisionSubPhase.DescriptionShort = "Select template to launch the bomb"; selectBoostTemplateDecisionSubPhase.DefaultDecisionName = selectBoostTemplateDecisionSubPhase.GetDecisions().First().Name; selectBoostTemplateDecisionSubPhase.RequiredPlayer = Selection.ThisShip.Owner.PlayerNo; selectBoostTemplateDecisionSubPhase.Start(); }
public void ResetPhaseColor(Phases phase) { this[phase].color = defaultPhaseColors[(int)phase]; }
public static void PlaceShip(int shipId, Vector3 position, Vector3 angles) { Phases.CurrentSubPhase.IsReadyForCommands = false; Roster.SetRaycastTargets(true); inReposition = false; Selection.ChangeActiveShip("ShipId:" + shipId); Board.PlaceShip(Selection.ThisShip, position, angles, delegate { Selection.DeselectThisShip(); Phases.Next(); }); }
public ConductivityExperiment() { heater = new PowerSupply(); ampere = new Amperimeter(); data = new DataAcquisition(); instruments[(int)InstrumentIndex.POWER_SUPPLY] = heater; instruments[(int)InstrumentIndex.AMPERIMETER] = ampere; instruments[(int)InstrumentIndex.DATA_AQUISICTION] = data; phase = Phases.PHASE1; list = new MeasurementsList(); string datahora = DateTime.Now.ToString("yyyy-MM-dd.hh.mm"); if (!Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); file = new StreamWriter(path + "results"+ datahora + fileExt); } else { file = new StreamWriter(path + "results" + datahora + fileExt); } }
private void RegisterJammedDecisionTrigger(GenericShip ship) { JamToken jamToken = (JamToken)ship.Tokens.GetToken(typeof(JamToken)); SubPhases.JammedDecisionSubPhase newPhase = (SubPhases.JammedDecisionSubPhase)Phases.StartTemporarySubPhaseNew( "Jammed", typeof(SubPhases.JammedDecisionSubPhase), Triggers.FinishTrigger ); newPhase.Assigner = jamToken.Assigner; Triggers.RegisterTrigger(new Trigger() { Name = "Jammed!", TriggerType = TriggerTypes.OnTokenIsAssigned, TriggerOwner = (Edition.Current is SecondEdition) ? jamToken.Assigner.PlayerNo: ship.Owner.PlayerNo, EventHandler = delegate { Selection.ActiveShip = ship; newPhase.Start(); } }); }
public GUITexture GetSkipPhaseButton(Player p, Phases phase) { return this.skipPhaseButtons[p][(int)phase]; }
private void AskBarrelRollPosition(object sender, System.EventArgs e) { BarrelRollPositionDecisionSubPhase selectBarrelRollPosition = (BarrelRollPositionDecisionSubPhase)Phases.StartTemporarySubPhaseNew( Name, typeof(BarrelRollPositionDecisionSubPhase), Triggers.FinishTrigger ); selectBarrelRollPosition.AddDecision("Forward", delegate { SetBarrelRollPosition(1.5f); }); selectBarrelRollPosition.AddDecision("Center", delegate { SetBarrelRollPosition(1); }); selectBarrelRollPosition.AddDecision("Backwards", delegate { SetBarrelRollPosition(0.5f); }); selectBarrelRollPosition.InfoText = "Barrel Roll: Select position"; selectBarrelRollPosition.DefaultDecisionName = "Center"; selectBarrelRollPosition.RequiredPlayer = Controller.PlayerNo; selectBarrelRollPosition.Start(); }
/// <summary> /// Throw exception on error /// </summary> void RunServerHandshake() { thread.WatchdogTick = DateTime.Now; //Handshaker SendToBackend(new Handshake(MinecraftServer.IP.ToString(), Vanilla.Endpoint.Port, HandshakeState.Login)); SendToBackend(new LoginStart(Player.MinecraftUsername)); thread.WatchdogTick = DateTime.Now; //No encryption with localhost?!!! :D /* //Read Encryption Request var encReq = new EncryptionRequest(PacketReader.Read(serverReader, EncryptionRequest.ID)); Debug.FromServer(encReq, Player); //Send response if (encReq.ServerID != "") throw new InvalidOperationException("Backend server online mode must be false, ID=-, got " + encReq.ServerID); crypto = new CryptoMC(serverStream, encReq); SendToBackend(new EncryptionResponse(crypto)); //Start encryption serverStream = crypto; serverReader = new EndianBinaryReader(EndianBitConverter.Big, serverStream); serverWriter = new EndianBinaryWriter(EndianBitConverter.Big, serverStream); */ byte[] buffer = PacketReader.ReadHandshake(serverStream); if (buffer[0] == 0) { string disconnectMessage = Encoding.ASCII.GetString(buffer, 2, buffer.Length - 2); Player.TellSystem("[Error]", disconnectMessage); throw new InvalidOperationException(disconnectMessage); } var compression = new SetCompression(buffer); maxUncompressed = compression.MaxSize; Debug.FromServer(compression, Player); var loginSuccess = new LoginSuccess(PacketReader.Read(serverStream)); OfflineUUID = loginSuccess.UUID; Debug.FromServer(loginSuccess, Player); //Read LoginRequest JoinGame res = new JoinGame(PacketReader.Read(serverStream)); Debug.FromServer(res, Player); thread.State = "Got Login"; EID = res.EntityID; Mode = (GameMode)res.GameMode; Dimension = res.Dimension; //Store UUID permanently - No need to store from backend since that is offline uuid phase = Phases.Gaming; //Send server JoinGame to the client Player.EntityID = res.EntityID; FromServerGaming(res); Cloak.SetCloak(Player, null); }
private void FinishBarrelRollAnimationPart2() { Phases.FinishSubPhase(typeof(BarrelRollExecutionSubPhase)); CallBack(); }
void ReceiverRunServer() { PacketFromServer p = null; try { thread.State = "Active loop"; while (phase == Phases.Gaming) { try { #if DEBUG prev8 = prev7; prev7 = prev6; prev6 = prev5; prev5 = prev4; prev4 = prev3; prev3 = prev2; prev2 = prev1; prev1 = p; #endif //thread.State = "Active loop, prev: " + p; p = PacketFromServer.ReadServer(serverStream); thread.WatchdogTick = DateTime.Now; Debug.FromServer(p, Player); //thread.State = "Got Packet " + p; } catch (EndOfStreamException) { phase = Phases.FinalClose; return; } catch (IOException) { phase = Phases.FinalClose; return; } catch (ObjectDisposedException) { phase = Phases.FinalClose; return; } catch (Exception e) { if (phase != Phases.FinalClose) { #if DEBUG Log.Write(new PrevException(prev8), Player); Log.Write(new PrevException(prev7), Player); Log.Write(new PrevException(prev6), Player); Log.Write(new PrevException(prev5), Player); Log.Write(new PrevException(prev4), Player); Log.Write(new PrevException(prev3), Player); Log.Write(new PrevException(prev2), Player); Log.Write(new PrevException(prev1), Player); #endif Log.Write(e, Player); phase = Phases.FinalClose; } return; } if (phase == Phases.FinalClose) break; try { FromServerGaming(p); } catch (Exception e) { Log.Write(e, Player); return; } } } finally { thread.State = "Loop ended, closing"; #if DEBUG Console.WriteLine("ServerReceiver Ended: " + Player); #endif serverStream.Close(); thread.State = "Stream closed"; } }
private void FinishDecloakAnimationPart2() { Phases.FinishSubPhase(typeof(DecloakExecutionSubPhase)); Selection.ThisShip.SpendToken(typeof(Tokens.CloakToken), CallBack); }
public static void FinishSelectionNoCallback() { Phases.FinishSubPhase(Phases.CurrentSubPhase.GetType()); Phases.CurrentSubPhase.Resume(); }
public override void FinishBoost() { Phases.FinishSubPhase(typeof(BoostExecutionSubPhase)); }
public override void ActionTake() { SelectSpacetugTargetSubPhaseSE newPhase = (SelectSpacetugTargetSubPhaseSE)Phases.StartTemporarySubPhaseNew( "Select target for Spacetug Tractor Array", typeof(SelectSpacetugTargetSubPhaseSE), Phases.CurrentSubPhase.CallBack ); newPhase.HostAction = this; newPhase.SpacetugOwner = this.HostShip; newPhase.Start(); }
public static async void Load() { if (!Directory.Exists(GetPath())) { Trace.WriteLine($"DBC folder \"{ GetPath() }\" not found"); return; } else { Trace.WriteLine($"DBC folder \"{ GetPath() }\" found"); } Trace.WriteLine("File name LoadTime Record count"); Trace.WriteLine("---------------------------------------------------------------------"); Parallel.ForEach(typeof(DBC).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), dbc => { Type type = dbc.PropertyType.GetGenericArguments()[0]; if (!type.IsClass) { return; } var startTime = DateTime.Now; var attr = type.GetCustomAttribute <DBFileAttribute>(); if (attr == null) { return; } var times = new List <long>(); var instanceType = typeof(Storage <>).MakeGenericType(type); var countGetter = instanceType.GetProperty("Count").GetGetMethod(); var instance = Activator.CreateInstance(instanceType, $"{ GetPath(attr.FileName) }.db2"); var recordCount = (int)countGetter.Invoke(instance, new object[] { }); try { dbc.SetValue(dbc.GetValue(null), instance); } catch (TargetInvocationException tie) { if (tie.InnerException is ArgumentException) { throw new ArgumentException($"Failed to load {attr.FileName}.db2: {tie.InnerException.Message}"); } throw; } var endTime = DateTime.Now; var span = endTime.Subtract(startTime); Trace.WriteLine($"{ attr.FileName.PadRight(33) } { TimeSpan.FromTicks(span.Ticks).ToString().PadRight(28) } { recordCount.ToString().PadRight(19) }"); }); await Task.WhenAll(Task.Run(() => { if (AreaTable != null) { foreach (var db2Info in AreaTable) { if (db2Info.Value.ParentAreaID != 0 && !Zones.ContainsKey(db2Info.Value.ParentAreaID)) { Zones.Add(db2Info.Value.ParentAreaID, db2Info.Value.ZoneName); } } } }), Task.Run(() => { if (MapDifficulty != null) { foreach (var mapDifficulty in MapDifficulty) { int difficultyID = 1 << mapDifficulty.Value.DifficultyID; if (MapSpawnMaskStores.ContainsKey(mapDifficulty.Value.MapID)) { MapSpawnMaskStores[mapDifficulty.Value.MapID] |= difficultyID; } else { MapSpawnMaskStores.Add(mapDifficulty.Value.MapID, difficultyID); } if (!MapDifficultyStores.ContainsKey(mapDifficulty.Value.MapID)) { MapDifficultyStores.Add(mapDifficulty.Value.MapID, new List <byte>() { mapDifficulty.Value.DifficultyID }); } else { MapDifficultyStores[mapDifficulty.Value.MapID].Add(mapDifficulty.Value.DifficultyID); } } } }), Task.Run(() => { if (CriteriaTree != null && Achievement != null) { ICollection <AchievementEntry> achievementLists = Achievement.Values; var achievements = achievementLists.GroupBy(achievement => achievement.CriteriaTree) .ToDictionary(group => group.Key, group => group.ToList()); foreach (var criteriaTree in CriteriaTree) { string result = ""; uint criteriaTreeID = criteriaTree.Value.Parent > 0 ? criteriaTree.Value.Parent : (uint)criteriaTree.Key; List <AchievementEntry> achievementList; if (achievements.TryGetValue(criteriaTreeID, out achievementList)) { foreach (var achievement in achievementList) { result = $"AchievementID: {achievement.ID} Description: \"{ achievement.Description }\""; } } if (!CriteriaStores.ContainsKey((ushort)criteriaTree.Value.CriteriaID)) { if (criteriaTree.Value.Description != string.Empty) { result += $" - CriteriaDescription: \"{criteriaTree.Value.Description }\""; } CriteriaStores.Add((ushort)criteriaTree.Value.CriteriaID, result); } else { CriteriaStores[(ushort)criteriaTree.Value.CriteriaID] += $" / CriteriaDescription: \"{ criteriaTree.Value.Description }\""; } } } }), Task.Run(() => { if (Faction != null && FactionTemplate != null) { foreach (var factionTemplate in FactionTemplate) { if (Faction.ContainsKey(factionTemplate.Value.Faction)) { FactionStores.Add((uint)factionTemplate.Key, Faction[factionTemplate.Value.Faction]); } } } }), Task.Run(() => { if (SpellEffect != null) { foreach (var effect in SpellEffect) { var tuple = Tuple.Create((uint)effect.Value.SpellID, (uint)effect.Value.EffectIndex); SpellEffectStores[tuple] = effect.Value; } } }), Task.Run(() => { if (PhaseXPhaseGroup != null) { foreach (var phase in PhaseXPhaseGroup) { if (!Phases.ContainsKey(phase.Value.PhaseGroupID)) { Phases.Add(phase.Value.PhaseGroupID, new List <ushort>() { phase.Value.PhaseID }); } else { Phases[phase.Value.PhaseGroupID].Add(phase.Value.PhaseID); } } } })); }
// Use this for initialization void Start() { HOTween.Init(); landscape.CreateLandscape(); /* foreach(var block in landscape.blocks) { //Randomly create number of pop units on tile int numPop = 2; // Random.Range(0, block.maxPopulation + 1); var god = gods[Random.Range(0, gods.Length)]; for (int i = 0; i < numPop; i++) { //Give the population a god var age = Random.Range(2, 4); var newPop = MakePopulation(god, age); block.AddPopulation(newPop); } } */ phase = Phases.Placement; godIndex = 0; Debug.Log("Placement...."); turn = 1; }
private void PhaseBegan (Vector2 position) { posBegin = posPrevious = posCurrent = position; time = 0; phase = Phases.Began; }
private void PhaseConversion (Phases phase) { if (this.phase == phase) return; switch (this.phase) { case Phases.Began: switch (phase) { case Phases.Stationary: { break; } case Phases.Moved: { break; } case Phases.Ended: { break; } default: return; } break; case Phases.Stationary: switch (phase) { case Phases.Moved: { break; } case Phases.Ended: { break; } default: return; } Debug.Log (string.Format ("Stationary time: {0:F2}", stationaryTime)); break; case Phases.Moved: switch (phase) { case Phases.Stationary: { Swiped (phase, moveInfo); break; } case Phases.Ended: { Swiped (phase, moveInfo); break; } default: return; } moveInfo.Clear (); break; default: return; } Debug.Log ("Phase Conversion from " + this.phase + " to " + phase); this.phase = phase; }
public override void SkipButton() { Phases.FinishSubPhase(typeof(CoordinateTargetSubPhase)); CallBack(); }
public bool Dispatch() { //Initializing event progress flags PropagationStopped = false; ImmediatePropagationStopped = false; DefaultPrevented = false; var eventTarget = CurrentTarget as DOM.EventTarget; if (eventTarget != null) { Debug.WriteLine("TARGET = " + eventTarget.ToString()); } else { Debug.WriteLine("TARGET IS NULL"); } Phase = JSEvent.Phases.AtTarget; bool eventBubblingCancelled = false; if (eventTarget != null) { var eventListeners = eventTarget.GetEventListeners(Data.Type, false); if (eventListeners != null) eventBubblingCancelled = eventListeners.HandleEvent(this); if (eventListeners == null) { Debug.WriteLine("Listener list is null!"); } CurrentTarget = eventTarget.Parent as DOM.EventTarget; } //Implementing bubbling accroding to HTML Spec (Document Object Model Events section 1.2.3). if (this.Bubbles && eventTarget != null) { Debug.WriteLine("EVENT BUBBLING"); //Bubbling loop (outer loop) Phase = JSEvent.Phases.Bubbling; var bubllingTargetList = new List<DOM.EventTarget>(); var tempTarget = eventTarget.Parent as DOM.EventTarget; while (tempTarget != null) { bubllingTargetList.Add(tempTarget); tempTarget = tempTarget.Parent as DOM.EventTarget; } for (int i = 0; (i < bubllingTargetList.Count) && (!eventBubblingCancelled); i++) { CurrentTarget = bubllingTargetList[i]; tempTarget = CurrentTarget as DOM.EventTarget; if (tempTarget != null) { Debug.WriteLine("curr TARGET = " + CurrentTarget.ToString()); } var eventListeners = tempTarget.GetEventListeners(Data.Type, false); if (eventListeners != null) eventBubblingCancelled = eventListeners.HandleEvent(this); CurrentTarget = CurrentTarget.Parent; } } bool cancelled = (DefaultPrevented && Cancelable); if (hasDefaultAction) { if (!cancelled) { Debug.WriteLine("Performing default action!"); DefaultAction(); } else { Debug.WriteLine("Ignoring the default action as event Cancelable is {0} and cancelled flag is {1}", Cancelable, cancelled); } } //According to SPEC the return value is false if the default action is cancelled return cancelled; }
public void InitializeCreatedEvent(EventClasses eventClass, WrappedObject target) { Data.EventClass = eventClass; Data.Type = EventTypes.ZoommInvalid; Data.Target = target; CurrentTarget = target; Bubbles = false; Cancelable = true; DefaultPrevented = false; IsTrusted = false; Phase = Phases.AtTarget; InitializeEventFlags(); UpdateMap(); }
public void ConfirmShipSetup(int shipId, Vector3 position, Vector3 angles) { Roster.SetRaycastTargets(true); inReposition = false; Selection.ChangeActiveShip("ShipId:" + shipId); Board.PlaceShip(Selection.ThisShip, position, angles, delegate { Selection.DeselectThisShip(); Phases.Next(); }); }
public SkipToPhaseCommand(PhaseSkipToController SkipController, Phases selectedPhase) { // TODO: Complete member initialization this.SkipController = SkipController; this.selectedPhase = selectedPhase; }
public override void Initialize() { Phases.FinishSubPhase(typeof(SetupSubPhase)); }