/// <summary> /// Parse a line of option commands. /// These may be either whitespace or comma separated /// </summary> /// <param name="l">The LexSpan of all the commands on this line</param> internal void ParseOption(LexSpan l) { char[] charSeparators = new char[] { ',', ' ', '\t' }; string strn = aast.scanner.Buffer.GetString(l.startIndex, l.endIndex); string[] cmds = strn.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); foreach (string s in cmds) { OptionState rslt = this.processOption2(s); switch (rslt) { case OptionState.clear: break; case OptionState.errors: handler.ListError(l, 74, s); break; case OptionState.inconsistent: handler.ListError(l, 84, s); break; case OptionState.alphabetLocked: handler.ListError(l, 83, s); break; default: break; } } }
public void SetState(OptionState state) { gameObject.SetActive(true); AttackButton.gameObject.SetActive(false); SpellButton.gameObject.SetActive(false); ItemButton.gameObject.SetActive(false); WaitButton.gameObject.SetActive(false); foreach (var button in ChoiseButtons) { Destroy(button.gameObject); } ChoiseButtons.Clear(); switch (state) { case OptionState.None: ChoiseButtons.Clear(); gameObject.SetActive(false); break; case OptionState.Main: AttackButton.gameObject.SetActive(true); SpellButton.gameObject.SetActive(true); ItemButton.gameObject.SetActive(true); WaitButton.gameObject.SetActive(true); GLG.cellSize = new Vector2(100, 40); if (Fighter.Selected != null && Fighter.Selected.GetComponent <Atributes>().CharClass == CharacterClass.Mage) { SpellButton.GetComponentInChildren <Text>().text = "Spell"; SpellButton.onClick.RemoveAllListeners(); SpellButton.onClick.AddListener(delegate { Magic(); }); } else { SpellButton.GetComponentInChildren <Text>().text = "Power"; SpellButton.onClick.AddListener(delegate { Power(); }); } break; case OptionState.Attacks: GLG.cellSize = new Vector2(40, 40); SetAttacks(); break; case OptionState.Powers: break; case OptionState.Spells: break; case OptionState.Items: break; default: break; } }
public Option(int id, Engineer e, Request r, int startday) { Id = id; E = e; R = r; Startday = startday; Cost = 0; state = OptionState.Available; }
/// <summary> /// Initializes a new instance of the <see cref="Some{A}"/> struct. /// </summary> /// <param name="value">Value to wrap.</param> public Some(A value) { if (value.IsNull()) { throw new ArgumentNullException(nameof(value), "Cannot wrap a null value in a 'Some'; use 'None' instead"); } State = OptionState.Some; this.value = value; }
/// <summary> /// Set the state of viewer options, including sunlight, Street View, and historical imagery. /// </summary> /// <param name="option"> /// The ViewerOption. /// </param> /// <param name="value"> /// The ViewerOptionsValue. /// </param> public void SetOption(ViewerOption option, OptionState value) { try { this.viewerOptions.setOption((int)option, (int)value); this.ApplyOptions(); } catch (COMException) { } }
public void Initialize(OptionState state) { _mboShutdownParams["Flags"] = Convert.ToString((int)state); _mboShutdownParams["Reserved"] = "0"; foreach (var o in _mcWin32.GetInstances()) { var manObj = (ManagementObject)o; manObj.InvokeMethod("Win32Shutdown", _mboShutdownParams, null); } }
public virtual void select(InputHandlerComponent i, ref string state) { if (i.getButton("Select", true)) { if (Selected != null) { Selected(this, new EventArgs()); } state = menuLink; } }
public OptionType(string stringText, string fontName, Color color, Vector2 stringVector, OptionAction optionAction, bool activate, Rectangle highlightRect, string highlightName) { option = new StandardState(new StringType(stringText, stringVector, color), fontName); highlighted = new HighlightState(option, highlightRect, highlightName); menuLink = state.ToString(); action = optionAction; alignment = TextAlignment.right; activateTransition = activate; activateSelected = true; state = OptionState.standard; }
public OptionType(string stringText, string fontName, Color color, Vector2 stringVector, string rState, Rectangle highlightRect, string highlightName, TextAlignment textAlignment) { option = new StandardState(new StringType(stringText, stringVector, color), fontName); highlighted = new HighlightState(option, highlightRect, highlightName); menuLink = rState; action = OptionAction.next; alignment = textAlignment; activateTransition = true; activateSelected = true; state = OptionState.standard; }
//private void InitLaserVector() //{ // //eu = Quaternion.FromToRotation(Vector3.up, startPoint.transform.position - endPoint.transform.position).eulerAngles.z; // lineWidthStart = startPoint.bounds.extents.x * 2.0f; // lineWidthEnd = endPoint.bounds.extents.x * 2.0f; // lineRenderer.startWidth = lineWidthStart; // lineRenderer.endWidth = lineWidthEnd; // lineCollider.transform.position = startPoint.transform.position; // lineCollider.size = new Vector2(lineWidthStart, startPoint.bounds.extents.y * 2.0f); // direction = opCurves.SeekDirection(endPoint.transform.position, playerPosition.position); // angle = Quaternion.FromToRotation(Vector3.up, startPoint.transform.position - (Vector3)playerPosition.position).eulerAngles.z; // lineCollider.transform.rotation = Quaternion.Euler(0, 0, angle - 90.0f); // startPoint.transform.rotation = Quaternion.Euler(0, 0, angle); // endPoint.transform.rotation = Quaternion.Euler(0, 0, angle); //} //private void ActivateLaser() //{ // //eu = Quaternion.FromToRotation(Vector3.up, startPoint.transform.position - endPoint.transform.position).eulerAngles.z; // //LineCollider.transform.rotation = Quaternion.Euler(0, 0, eu - 90.0f); // float size = Vector2.Distance(startPoint.transform.position, endPoint.transform.position); // lineCollider.size = new Vector2(size + lineCollider.size.y, lineCollider.size.y); // lineCollider.transform.position = (startPoint.transform.position + endPoint.transform.position) * 0.5f; // //startPoint.transform.rotation = Quaternion.Euler(0, 0, eu); // //endPoint.transform.rotation = Quaternion.Euler(0, 0, eu); // lineRenderer.SetPosition(0, startPoint.transform.position); // lineRenderer.SetPosition(1, endPoint.transform.position); //} public void InitOption(Vector2 myPosition, Transform spawnStartPos, Transform player) { this.myPosition = this.transform.position = myPosition; this.gameObject.SetActive(true); spawnPositionStart = spawnStartPos; playerPosition = player; optionState = OptionState.Spawned; screenCenter = playerPosition.position; screenCenter.y = Screen.height * 0.7f; //Debug.Log("my pos : " + this.transform.position); }
private void Start() { if (PlayerPrefsManager.GetVibration() == "vibrationOn") { state = OptionState.Enabled; ApplyVisual(enabledSprite); } else { state = OptionState.Disabled; ApplyVisual(disabledSprite); } }
public void AddSASp(int s, int a, int sP) { if (!initSet.Keys.Contains(s)) { initSet.Add(s, new OptionState(s)); } OptionState os = initSet[s]; if (os.aSp.Keys.Contains(a)) { throw new Exception("Action already exists on current option-state!"); } os.aSp.Add(a, sP); }
/// <summary> /// Initializes a new instance of the <see cref="Option{A}"/> struct. /// </summary> /// <param name="option">IEnumerable as value source.</param> public Option(IEnumerable <A> option) { var first = option.Take(1).ToArray(); if (first.Length == 0) { _optionState = OptionState.None; _value = default(A); } else { _optionState = OptionState.Some; _value = first[0]; } }
private void OnOptions() { StateLayer val = default(StateLayer); if (StateManager.TryGetLayer("OptionUI", ref val)) { StateManager.SetActiveInputLayer(val); UIManager.instance.NotifyLayerIndexChange(); OptionState optionState = new OptionState { onStateClosed = OnOptionsClosed }; val.GetChainEnd().SetChildState(optionState, 0); } m_popupMenu.Close(); }
private void LoadGameStates() { TitleState = new TitleState(_stateMachine); OptionsState = new OptionState(_stateMachine); PauseState = new PauseState(_stateMachine); State3D = new GameState3D(_stateMachine); State2D = new GameState2D(_stateMachine); if (sceneName == "main") { _stateMachine.ChangeState(State2D); } else { _stateMachine.ChangeState(TitleState); } }
static void BadOption(string arg, OptionState rslt) { string marker = ""; switch (rslt) { case OptionState.errors: marker = "unknown argument"; break; case OptionState.inconsistent: marker = "inconsistent argument"; break; case OptionState.alphabetLocked: marker = "can't change alphabet"; break; } Console.Error.WriteLine("{0} {1}: {2}", prefix, marker, arg); }
public Game1() { Settings.Load(); graphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = Settings.Resolution.X, PreferredBackBufferHeight = Settings.Resolution.Y }; graphics.ApplyChanges(); foreach (var v in graphics.GraphicsDevice.Adapter.SupportedDisplayModes) { Point p = new Point(v.Width, v.Height); string s = v.Width + " by " + v.Height; if (v.Width >= 1280 && v.Height >= 720) { Resolutions.Add(s, p); } } Content.RootDirectory = "Content"; stateManager = new StateManager(this); Components.Add(stateManager); textureManager = new TextureManager(this); Components.Add(textureManager); Components.Add(new FontManager(this)); Components.Add(new Xin(this)); mainMenuState = new MainMenuState(this); titleState = new TitleState(this); optionState = new OptionState(this); gamePlayState = new GamePlayState(this); stateManager.ChangeState(titleState); IsMouseVisible = true; }
private OptionState[] ListResolutions() { var result = new List <OptionState>(); var resolutions = new List <string>(); foreach (var resolution in Screen.resolutions) { if (currentAspectRatio != resolution.GetKnownAspectRatio()) { continue; } var name = resolution.width + "x" + resolution.height; // filter out multiple refresh rates. if (resolutions.Contains(name)) { continue; } resolutions.Add(name); // add resolution to result. var option = new OptionState { isOn = resolution.width == Screen.width && resolution.height == Screen.height, text = name, }; option.onOptionSet.AddListener(() => { Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen); UpdateRefreshRates(); }); result.Add(option); } return(result.ToArray()); }
private OptionState[] ListRefreshRates() { var result = new List <OptionState>(); foreach (var resolution in Screen.resolutions) { if (Screen.width != resolution.width || Screen.height != resolution.height) { continue; } var refreshRate = resolution.refreshRate; var option = new OptionState { isOn = Screen.currentResolution.refreshRate == refreshRate, text = refreshRate.ToString(), }; option.onOptionSet.AddListener(() => Screen.SetResolution(Screen.width, Screen.height, Screen.fullScreen, refreshRate)); result.Add(option); } // Add the current refresh rate in case the current resolution is weird. if (result.Count == 0) { var option = new OptionState { isOn = true, text = Screen.currentResolution.refreshRate.ToString(), }; result.Add(option); } return(result.ToArray()); }
//public void activateLaser(bool active) //{ // activeLaser = active; //} /// <summary> /// /// </summary> /// <param name="pattern"> /// 0. ReflectLaser<para /> /// 1. RapidLaser<para /> /// 2. LaserNo5Laser<para /> /// </param> public void SetLaserPattern(int pattern, float laserNo5Timer = 0) { if (optionState == OptionState.Idle) { float z = Quaternion.FromToRotation(Vector3.up, this.transform.position - playerPosition.position).eulerAngles.z; optionRotation = Quaternion.Euler(0, 0, z); myQuaternionRotation = this.transform.rotation; switch (pattern) { case 0: myTag = "ReflectLaser"; startPoint.gameObject.tag = endPoint.gameObject.tag = myTag; attackPattern = AttackPattern.ReflectLaser; break; case 1: myTag = "RapidLaser"; startPoint.gameObject.tag = endPoint.gameObject.tag = myTag; //this.transform.rotation = Quaternion.Euler(0, 0, optionRotation); attackPattern = AttackPattern.RapidLaser; break; case 2: case 3: myTag = "LaserNo5Laser"; startPoint.gameObject.tag = endPoint.gameObject.tag = myTag; laserCurrentTimer = laserNo5Timer; attackPattern = AttackPattern.LaserNo5Laser; break; } optionState = OptionState.Launching; } else { Debug.Log("State is not Idle"); return; } }
private OptionState[] ListAspectRatios() { var result = new List <OptionState>(); foreach (var aspectRatio in AspectRatio.knownAspectRatios) { var option = new OptionState { isOn = aspectRatio == currentAspectRatio, text = aspectRatio.ToString(), }; option.onOptionSet.AddListener(() => { currentAspectRatio = aspectRatio; UpdateResolutions(); }); result.Add(option); } return(result.ToArray()); }
public void PushButton(OptionState clickButton) { OptionState prevState = optionState; OptionState nextState = (OptionState)clickButton; Debug.Log(prevState); //if((int)nextState<0) //{ // nextState = OptionState.None; //} //if ((int)nextState >= (int)OptionState.Num) //{ // nextState = OptionState.None; //} if (prevState.Equals(OptionState.None))//何もない状態の時 { //anim.SetTrigger("EndAnim"); if (nextState.Equals(OptionState.Army))//Armyに移動 { anim.SetBool(firstAnimFlag, true); anim.SetBool(isOpenFlag, false); //OpenFlag(); //anim.SetTrigger("FirstAnim"); armyFlag = !armyFlag; selectFlag = false; } else if (nextState.Equals(OptionState.Select))//Selectに移動 { Debug.Log("ここ来た"); anim.SetBool(firstAnimFlag, true); anim.SetBool(isOpenFlag, false); //OpenFlag(); //anim.SetTrigger("FirstAnim"); armyFlag = false; selectFlag = !selectFlag; } if (nextState.Equals(OptionState.None)) { return; //何もしてない。 } } if (prevState.Equals(OptionState.Army)) //軍編成を開いている時 { if (nextState.Equals(OptionState.Army)) //閉じる処理 { nextState = OptionState.None; anim.SetBool(isOpenFlag, true); anim.SetBool(firstAnimFlag, false); armyFlag = false; } else if (nextState.Equals(OptionState.Select))//Selectに移動 { anim.SetTrigger(transitionFirst); BoolFlag(); anim.SetBool(firstAnimFlag, false); armyFlag = false; selectFlag = true; } if (nextState.Equals(OptionState.None))//閉じる処理 { anim.SetBool(isOpenFlag, true); anim.SetBool(firstAnimFlag, false); armyFlag = false; selectFlag = false; } } if (prevState.Equals(OptionState.Select)) //戦場選択を開いている時 { if (nextState.Equals(OptionState.Army)) //Armyに移動 { anim.SetTrigger(transitionFirst); BoolFlag(); anim.SetBool(firstAnimFlag, false); armyFlag = true; selectFlag = false; } else if (nextState.Equals(OptionState.Select))//閉じる処理 { Debug.Log("今ここ"); //anim.SetBool(isOpenFlag, true); OpenFlag(); armyFlag = false; selectFlag = false; } if (nextState.Equals(OptionState.None))//閉じる処理 { anim.SetBool(isOpenFlag, true); //OpenFlag(); anim.SetBool(firstAnimFlag, false); armyFlag = false; selectFlag = false; } } optionState = nextState; }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); spriteBatch.Begin(); if (baseState.Equals("main")) //Frame is on the title screen { if (cursor.getStandingImage() != FOREGROUND_IMAGES["titleCursor"]) { cursor.setStand(FOREGROUND_IMAGES["titleCursor"]); } spriteBatch.Draw(TITLE_IMAGES["background"], new Vector2(0, 0), Color.White); spriteBatch.Draw(TITLE_IMAGES["title"], new Vector2(100, 25), Color.White); if (playButton.isSelected()) { spriteBatch.Draw(playButton.getStandingImage(), playButton.getPosition(), Color.LimeGreen); } else { spriteBatch.Draw(playButton.getStandingImage(), playButton.getPosition(), Color.White); } if (optionButton.isSelected()) { spriteBatch.Draw(optionButton.getStandingImage(), optionButton.getPosition(), Color.LimeGreen); } else { spriteBatch.Draw(optionButton.getStandingImage(), optionButton.getPosition(), Color.White); } cursor.draw(spriteBatch); if (playButton.isClicked()) { baseState = "game"; } } else if (baseState.Equals("game")) //Frame is on the game screen { if (cursor.getStandingImage() != FOREGROUND_IMAGES["gameCursor"]) { GameState.initiate(cursor); cursor.setStand(FOREGROUND_IMAGES["gameCursor"]); } cursor.draw(spriteBatch); GameState.draw(spriteBatch); } else if (baseState.Equals("options")) { if (cursor.getStandingImage() != FOREGROUND_IMAGES["titleCursor"]) { cursor.setStand(FOREGROUND_IMAGES["titleCursor"]); } cursor.draw(spriteBatch); OptionState.draw(spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }
private static void GenerateScanner(string[] args) { bool fileArg = false; TaskState task = new TaskState(); OptionState opResult = OptionState.clear; if (args.Length == 0) { Usage("No arguments"); } for (int i = 0; i < args.Length; i++) { if (args[i][0] == '/' || args[i][0] == '-') { string arg = args[i].Substring(1); opResult = task.ParseOption(arg); if (opResult != OptionState.clear && opResult != OptionState.needCodepageHelp && opResult != OptionState.needUsage) { BadOption(arg, opResult); } } else if (i != args.Length - 1) { Usage("Too many arguments"); } else { fileArg = true; } } if (task.Version) { task.Msg.WriteLine("GPLEX version: " + task.VerString); } if (opResult == OptionState.needCodepageHelp) { CodepageHelp(fileArg); } if (opResult == OptionState.errors) { Usage(null); // print usage and abort } else if (!fileArg) { Usage("No filename"); } else if (opResult == OptionState.needUsage) { Usage(); // print usage but do not abort } try { task.Process(args[args.Length - 1]); } catch (Exception ex) { if (ex is TooManyErrorsException) { return; } Console.Error.WriteLine(ex.Message); throw; } finally { if (task.ErrNum + task.WrnNum > 0 || task.Listing) { task.MakeListing(); } if (task.ErrNum + task.WrnNum > 0) { task.ErrorReport(); } else if (task.Verbose) { task.Msg.WriteLine("GPLEX <" + task.FileName + "> Completed successfully"); } task.Dispose(); } }
public async void GetCompetitionData() { try { Results results = new Results(); using (IDbConnection conn = this.Connection()) { List <Competition> links = conn.Query <Competition>("SELECT * FROM COMPETITION").ToList(); foreach (Competition linksItem in links) { HttpClient httpClient = new HttpClient(); String html = await httpClient.GetStringAsync(constantUrl + linksItem.link); HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(html); List <HtmlNode> MatchHtml = htmlDocument.DocumentNode.Descendants("tr") .Where(node => (node.GetAttributeValue("id", "") .Contains("page_competition_1_block_competition_matches"))).ToList(); foreach (HtmlNode MatchListItem in MatchHtml) { string date = results.GetMatchData(MatchListItem).Item1; DateTime evaluatedDate = Convert.ToDateTime(date); string homeTeam = results.GetMatchData(MatchListItem).Item2; string awayTeam = results.GetMatchData(MatchListItem).Item3; string score = results.GetMatchData(MatchListItem).Item4; string homeScore = ""; string awayScore = ""; ResultState state = ResultState.UNDEFINED; OptionState optionState = OptionState.Result; string time = ""; if (IsSubstringable(score, ref homeScore, ref awayScore) && score.Contains(':')) { optionState = OptionState.Fixture; time = score; this.SlicingData(linksItem.country, linksItem.titleOfCompetition, evaluatedDate, homeTeam, awayTeam, homeScore, awayScore, OptionState.Fixture.ToString(), time); } else if (IsSubstringable(score, ref homeScore, ref awayScore) && score.Contains('P') || score.Contains('E') || score.Contains("PSTP")) { state = ResultState.POSTPONED; recalledMatch.InsertRecalledMatch(linksItem.country, linksItem.titleOfCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } else if (IsSubstringable(score, ref homeScore, ref awayScore) && IsNumber(homeScore, awayScore)) { optionState = OptionState.Result; this.SlicingData(linksItem.country, linksItem.titleOfCompetition, evaluatedDate, homeTeam, awayTeam, homeScore, awayScore, OptionState.Result.ToString(), time); } else if (IsSubstringable(score, ref homeScore, ref awayScore) && score == "CANC") { state = ResultState.CANCELLED; recalledMatch.InsertRecalledMatch(linksItem.country, linksItem.titleOfCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } else { state = ResultState.UNDEFINED; recalledMatch.InsertRecalledMatch(linksItem.country, linksItem.titleOfCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } } } } } catch (HttpRequestException http) { MessageBox.Show("PLEASE CHECK YOUR CONNECTION, YOU NOT BE CONNECTED TO THE INTERNET\nCompetitionData\n" + http.Message); } catch (TaskCanceledException tex) { this.GetCompetitionData(); } catch (Exception tex) { this.GetCompetitionData(); } string test = ""; }
public void SetState(OptionState state) { this.state = state; }
private void SetState(OptionState newState) { this.state = newState; if (this.state == OptionState.MainMenu) { this.optionText = new GameText[4]; this.optionText[0] = new GameText("CONTINUE"); this.optionText[0].Shadow = true; this.optionText[0].Location = (PointF) new Point(60, 40); this.optionText[1] = new GameText("DEFINE KEYS"); this.optionText[1].Shadow = true; this.optionText[1].Location = (PointF) new Point(60, 60); this.optionText[2] = new GameText("HELP"); this.optionText[2].Shadow = true; this.optionText[2].Location = (PointF) new Point(60, 80); this.optionText[3] = new GameText("NEW GAME"); this.optionText[3].Shadow = true; this.optionText[3].Location = (PointF) new Point(60, 100); this.numOptions = 4; } else if (this.state == OptionState.KeyMenu) { this.optionText = new GameText[8]; for (int i = 0; i < 7; i++) { this.optionText[i] = new GameText(this.keyNames[i] + GameEngine.Framework.KeyToName(GameEngine.Framework.GetKeyMapping(this.gameKeys[i]))); this.optionText[i].Shadow = true; this.optionText[i].Location = (PointF) new Point(60, 40 + (20 * i)); } this.optionText[7] = new GameText("GO BACK"); this.optionText[7].Shadow = true; this.optionText[7].Location = (PointF) new Point(60, 180); this.numOptions = 8; } else if (this.state == OptionState.ContinueMenu) { bool flag = false; Point point = new Point(60, 40); this.optionText = new GameText[4]; this.slots = new int[4]; int index = 0; for (int j = 1; j <= 4; j++) { string saveDescript = GameEngine.Game.GetSaveDescript(j); if (!saveDescript.Equals("EMPTY")) { flag = true; this.slots[index] = j; this.optionText[index] = new GameText(string.Concat(new object[] { "SLOT ", j, ": ", saveDescript.ToUpper() })); this.optionText[index].Shadow = true; this.optionText[index].Location = (PointF) new Point(point.X, point.Y); point.Y += 20; index++; } } this.numOptions = index; for (int k = index; k <= 3; k++) { this.optionText[k] = new GameText(" "); } if (!flag) { this.currentOption = 1; this.numOptions = 1; this.optionText[1].SetText("NO SAVED GAMES FOUND"); this.optionText[1].Shadow = true; this.optionText[1].Location = (PointF) new Point(point.X, point.Y); } } }
/// <summary> /// Initializes a new instance of the <see cref="Option{A}"/> struct. /// </summary> /// <param name="isSome">Is the option in a Some state.</param> /// <param name="value">Option value.</param> private Option(bool isSome, A value) { _optionState = isSome ? OptionState.Some : OptionState.None; _value = value; }
public Options(string[] argv) { Sources = new List <string>(); References = new List <string>(); OptionState state = OptionState.GetSources; CompileOutputMode?mode = null; foreach (var arg in argv) { switch (state) { case OptionState.GetMode: CompileOutputMode m; if (Enum.TryParse <CompileOutputMode>(arg, out m)) { mode = m; } else { throw new CmdLineException(string.Format(ErrorMessages.E_0005_CmdLine_UnknownOutputMode, arg)); } state = OptionState.GetSources; break; case OptionState.GetOutput: OutputPath = arg; state = OptionState.GetSources; break; case OptionState.GetReference: References.Add(arg); state = OptionState.GetSources; break; case OptionState.GetSources: if (arg == ModeSwitch) { state = OptionState.GetMode; } else if (arg == OutputSwitch) { state = OptionState.GetOutput; } else if (arg == ReferenceSwitch) { state = OptionState.GetReference; } else { Sources.Add(arg); } break; } } // sanity checks if (string.IsNullOrWhiteSpace(OutputPath)) { throw new CmdLineException(ErrorMessages.E_0004_CmdLine_NoOutputPath); } if (mode == null) { if (OutputPath.ToUpper().EndsWith(".DLL")) { mode = CompileOutputMode.Library; } else if (OutputPath.ToUpper().EndsWith(".EXE")) { mode = CompileOutputMode.Executable; } else { throw new CmdLineException(string.Format(ErrorMessages.E_0005_CmdLine_UnknownOutputMode, "?")); } } }
public void SetState(OptionState state) { gameObject.SetActive(true); AttackButton.gameObject.SetActive(false); SpellButton.gameObject.SetActive(false); ItemButton.gameObject.SetActive(false); WaitButton.gameObject.SetActive(false); foreach (var button in ChoiseButtons) { Destroy(button.gameObject); } ChoiseButtons.Clear(); switch (state) { case OptionState.None: ChoiseButtons.Clear(); gameObject.SetActive(false); break; case OptionState.Main: AttackButton.gameObject.SetActive(true); SpellButton.gameObject.SetActive(true); ItemButton.gameObject.SetActive(true); WaitButton.gameObject.SetActive(true); GLG.cellSize = new Vector2(100, 40); if (Fighter.Selected != null && Fighter.Selected.GetComponent<Atributes>().CharClass == CharacterClass.Mage) { SpellButton.GetComponentInChildren<Text>().text = "Spell"; SpellButton.onClick.RemoveAllListeners(); SpellButton.onClick.AddListener(delegate { Magic(); }); } else { SpellButton.GetComponentInChildren<Text>().text = "Power"; SpellButton.onClick.AddListener(delegate { Power(); }); } break; case OptionState.Attacks: GLG.cellSize = new Vector2(40, 40); SetAttacks(); break; case OptionState.Powers: break; case OptionState.Spells: break; case OptionState.Items: break; default: break; } }
public async void FullUpdateOfResults() { int countTimeout = 0; RecalledMatch reviewedMatch = new RecalledMatch(); Data_Organiser dor = new Data_Organiser(); Fixture fixture = new Fixture(); using (IDbConnection conn = dor.Connection()) { try { var links = conn.Query <Team>(" SELECT * FROM [Football].[dbo].[TEAM]"); foreach (Team linksItem in links) { HttpClient httpClient = new HttpClient(); String html = await httpClient.GetStringAsync(constantUrl + linksItem.link); HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(html); List <HtmlNode> MatchHtml = htmlDocument.DocumentNode.Descendants("tr") .Where(node => (node.GetAttributeValue("id", "") .Contains("page_team_1_block_team_matches"))).ToList(); foreach (HtmlNode MatchListItem in MatchHtml) { string date = GetMatchData(MatchListItem).Item1; DateTime evaluatedDate = Convert.ToDateTime(date); string homeTeam = GetMatchData(MatchListItem).Item2; string awayTeam = GetMatchData(MatchListItem).Item3; string score = GetMatchData(MatchListItem).Item4; string homeScore = ""; string awayScore = ""; ResultState state = ResultState.UNDEFINED; OptionState optionState = OptionState.Result; string time = ""; if (dor.IsSubstringable(score, ref homeScore, ref awayScore) && score.Contains(':')) { optionState = OptionState.Fixture; time = score; //dor.SlicingData(linksItem.country, linksItem.currentCompetition, evaluatedDate, homeTeam, awayTeam, // homeScore, awayScore, OptionState.Fixture.ToString(), score); fixture.InsertFixture(linksItem.country, linksItem.currentCompetition, homeTeam, awayTeam, evaluatedDate, score); } else if (dor.IsSubstringable(score, ref homeScore, ref awayScore) && score.Contains('P') || score.Contains('E') || score.Contains("PSTP")) { state = ResultState.POSTPONED; reviewedMatch.InsertRecalledMatch(linksItem.country, linksItem.currentCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } else if (dor.IsSubstringable(score, ref homeScore, ref awayScore) && score == "CANC") { state = ResultState.CANCELLED; reviewedMatch.InsertRecalledMatch(linksItem.country, linksItem.currentCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } else if (dor.IsSubstringable(score, ref homeScore, ref awayScore) && dor.IsNumber(homeScore, awayScore)) { optionState = OptionState.Result; dor.SlicingData(linksItem.country, linksItem.currentCompetition, evaluatedDate, homeTeam, awayTeam, homeScore, awayScore, OptionState.Result.ToString(), time); } else { state = ResultState.UNDEFINED; reviewedMatch.InsertRecalledMatch(linksItem.country, linksItem.currentCompetition, evaluatedDate, homeTeam, awayTeam, state.ToString()); continue; } } } } catch (TaskCanceledException tex) { Debug.WriteLine("\n" + tex.Message + " " + DateTime.Now + "\n"); FullUpdateOfResults(); //countTimeout++; //if (countTimeout >= 5) //{ //} } catch (Exception ex) { Debug.WriteLine("\n" + ex.Message + " " + DateTime.Now + "\n"); //FullUpdateOfResults(); //reviewedMatch.InsertRecalledMatch("COUNTRY", "COMPETITION", DateTime.Now, // "HOME", "AWAY", "UNDEFINED"); } } }
//private void SetHpBarColor() //{ // bossShieldColor.disabledColor = Color.Lerp(Color.red, Color.green, bossShieldSlider.value / bossShieldSlider.maxValue); // bossShieldSlider.colors = bossShieldColor; //} // Update is called once per frame void Update() { //if (optionState != OptionState.Spawned) //{ // optionRotation = Quaternion.FromToRotation(Vector3.up, this.transform.position - playerPosition.position).eulerAngles.z; // this.transform.rotation = Quaternion.Euler(0, 0, optionRotation); //} if (optionState == OptionState.Spawned) { spawnCurrentSpeed += Time.deltaTime * spawnSpeed * 2.0f; this.transform.position = Vector2.Lerp(myPosition, spawnPositionStart.position, spawnCurrentSpeed); if (spawnCurrentSpeed >= 1.0f) { optionState = OptionState.OnPosition; spawnCurrentSpeed = 0; hpBar.transform.position = this.transform.position; hpBar.transform.position = new Vector2(hpBar.transform.position.x, hpBar.transform.position.y + (optionRenderer.bounds.extents.y * 0.5f)); hpBar.gameObject.SetActive(true); } } if (optionState == OptionState.OnPosition) { //Debug.Log("On Position!"); optionState = OptionState.Idle; } if (optionState == OptionState.Idle) { } if (optionState == OptionState.Launching) { if (currentSpeedToCenter >= 1.0f) { currentSpeedToCenter += speedToCenter * Time.deltaTime; switch (attackPattern) { // Options on Postion case AttackPattern.ReflectLaser: this.transform.rotation = Quaternion.Lerp(myQuaternionRotation, optionRotation, currentSpeedToCenter); break; // Options on Postion case AttackPattern.RapidLaser: this.transform.rotation = Quaternion.Lerp(myQuaternionRotation, optionRotation, currentSpeedToCenter); this.transform.position = Vector2.Lerp(spawnPositionStart.position, screenCenter, currentSpeedToCenter); //this.transform.rotation = Quaternion.Euler(0, 0, optionRotation); break; case AttackPattern.LaserNo5Laser: break; default: Debug.LogError("Attack error"); break; } if (currentSpeedToCenter >= 1.0f) { optionState = OptionState.Attack; currentSpeedToCenter = 0; } } //else //{ // currentSpeedToCenter = speedToCenter * Time.deltaTime; // this.transform.position = Vector2.Lerp(spawnPositionStart.position, screenCenter, currentSpeedToCenter); //} } if (optionState == OptionState.Attack) { optionState = OptionState.Idle; GameObject laser; Laser script; switch (attackPattern) { // Options on Postion case AttackPattern.ReflectLaser: laser = Instantiate(laserPrefab.gameObject, this.transform.position, Quaternion.Euler(0, 0, 0)); script = laser.GetComponent <Laser>(); laserCurrentTimer = Random.Range(laserTimerMin, laserTimerMax); script.InitLaserVector(myTag, shotSpeedRivision); script.SetStartEndPointTimer(laserCurrentTimer); optionState = OptionState.Cooldown; break; // Options on Postion case AttackPattern.RapidLaser: laser = Instantiate(laserPrefab.gameObject, this.transform.position, Quaternion.Euler(0, 0, 0)); script = laser.GetComponent <Laser>(); laserCurrentTimer = Random.Range(laserTimerMin, laserTimerMax); script.InitLaserVector(myTag, shotSpeedRivision); script.SetStartEndPointTimer(laserCurrentTimer); optionState = OptionState.MoveBack; break; case AttackPattern.LaserNo5Laser: laser = Instantiate(laserPrefab.gameObject, this.transform.position, Quaternion.Euler(0, 0, 0)); script = laser.GetComponent <Laser>(); script.InitLaserVector(myTag, shotSpeedRivision); script.SetStartEndPointTimer(laserCurrentTimer); break; default: Debug.LogError("Attack error"); break; } } if (optionState == OptionState.MoveBack) { currentSpeedToCenter += speedToCenter * Time.deltaTime; this.transform.position = Vector2.Lerp(screenCenter, spawnPositionStart.position, currentSpeedToCenter); this.transform.rotation = Quaternion.Lerp(optionRotation, myQuaternionRotation, currentSpeedToCenter); if (currentSpeedToCenter >= 1.0f) { rotationSpeedToReady = 0; optionState = OptionState.Idle; } } if (optionState == OptionState.Cooldown) { laserCooldownTimerCheck += Time.deltaTime; if (laserCooldownTimerCheck >= laserCurrentTimer) { laserCooldownTimerCheck = 0; optionState = OptionState.Idle; } } //if (activeLaser == true) //{ // endPoint.transform.Translate(direction * Time.deltaTime, Space.World); // ActivateLaser(); //} }