public void Navigate(ControlOption control, object navigateObject = null) { PageControl newControl = null; switch(control) { case ControlOption.HTML: if (navigateObject != null) newControl = new HTMLControl(navigateObject, this, World); break; case ControlOption.Chart: newControl = new ChartControl(World, navigateObject as DwarfObject, this); break; case ControlOption.Map: newControl = new MapControl(World, navigateObject, this); break; case ControlOption.Search: newControl = new SearchControl(this); break; } if (newControl != null) { if (MakeNewTab()) { TabPages.Add(new DwarfTabPage(newControl)); } else { (SelectedTab as DwarfTabPage).NewPageControl(newControl); } } }
public void Navigate(ControlOption control, object navigateObject = null) { PageControl newControl = null; switch (control) { case ControlOption.HTML: if (navigateObject != null) { newControl = new HTMLControl(navigateObject, this, World); } break; case ControlOption.Chart: newControl = new ChartControl(World, navigateObject as DwarfObject, this); break; case ControlOption.Map: newControl = new MapControl(World, navigateObject, this); break; case ControlOption.Search: newControl = new SearchControl(this); break; } if (newControl != null) { if (MakeNewTab()) { TabPages.Add(new DwarfTabPage(newControl)); } else { (SelectedTab as DwarfTabPage).NewPageControl(newControl); } } }
protected void Start() { screenShake = Camera.main.GetComponent <CameraControl>(); if (SystemInfo.supportsGyroscope) { hasGyro = true; Input.gyro.enabled = true; Input.gyro.updateInterval = 1f / 60f; } lerpPosition = transform.position; origin = Input.acceleration * 90; Screen.sleepTimeout = SleepTimeout.NeverSleep; InvokeRepeating("Fire", 0, FireSpeed); SFX = GetComponent <AudioSource>(); rocketCurrentCD = 0; if (PlayerPrefs.HasKey("MasterVol")) { PlayerPrefs.GetFloat("MasterVol"); PlayerPrefs.GetFloat("MusicVol"); PlayerPrefs.GetFloat("SFXVol"); } ControlType = UIcontrols.useRoll ? ControlOption.ROLL : ControlOption.SLIDE; }
public static ControlOptionModel ToModel(this ControlOption entity) { return(new ControlOptionModel() { Id = entity.Id, Name = entity.Name, FunnyName = entity.FunnyName }); }
protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.Html) { //<a href=\"collection#" + attack.ID + "\">" + attack.GetOrdinal(attack.Ordinal) string objectType = ""; int id = 0; if (dObject is EventCollection) { objectType = "collection"; id = (dObject as EventCollection).Id; } else if (dObject.GetType() == typeof(HistoricalFigure)) { objectType = "hf"; id = (dObject as HistoricalFigure).Id; } else if (dObject.GetType() == typeof(Entity)) { objectType = "entity"; id = (dObject as Entity).Id; } else if (dObject.GetType() == typeof(WorldRegion)) { objectType = "region"; id = (dObject as WorldRegion).Id; } else if (dObject.GetType() == typeof(UndergroundRegion)) { objectType = "uregion"; id = (dObject as UndergroundRegion).Id; } else if (dObject.GetType() == typeof(Site)) { objectType = "site"; id = (dObject as Site).Id; } else { throw new Exception("Unhandled make link for type: " + dObject.GetType()); } string optionString = ""; if (option != ControlOption.Html) { optionString = "-" + option; } return("<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>"); }
/// <summary> /// Sets advanced configuration options. /// </summary> /// <param name="option">The control option to be set.</param> /// <param name="value">The value to set the control option to.</param> /// <returns>The operation result.</returns> public Status SetConfiguration(ControlOption option, uint value) { lock (_syncLock) { if (_initialized) { return((Status)SetConfigurationNative(option, value)); } else { return(Status.ConfigurationError); } } }
void OnMove() { if (controlOption == ControlOption.NULL) { //Turn on laser so the user can select a unit line.SetActive(true); controlOption = ControlOption.Move; vbbMove.gameObject.GetComponentInChildren <SpriteRenderer>().color = buttonsActivatedColor; } else { OnCancel(); } }
protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.Html) { string objectType; int id; if (dObject is EventCollection eventCollection) { objectType = "collection"; id = eventCollection.Id; } else if (dObject is HistoricalFigure historicalFigure) { objectType = "hf"; id = historicalFigure.Id; } else if (dObject is Entity entity) { objectType = "entity"; id = entity.Id; } else if (dObject is WorldRegion worldRegion) { objectType = "region"; id = worldRegion.Id; } else if (dObject is UndergroundRegion undergroundRegion) { objectType = "uregion"; id = undergroundRegion.Id; } else if (dObject is Site site) { objectType = "site"; id = site.Id; } else { throw new Exception("Unhandled make link for type: " + dObject.GetType()); } string optionString = ""; if (option != ControlOption.Html) { optionString = "-" + option; } return("<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>"); }
public void SaveControlOptionDirect([Values(ControlOption.Arrows, ControlOption.Paddle, ControlOption.Gyroscope)] ControlOption value) { //Arrange Option database = OptionFacade.Find(OptionName.Controls); Option saved; //Act database.Value = value; OptionFacade.Save(database); saved = OptionFacade.Find(OptionName.Controls); //Assert Assert.AreEqual(database, saved); Assert.AreEqual(database.Value, saved.Value); Assert.AreEqual(1, OptionFacade.FindAll().Count, Facade <OptionFacade> .ToStringAll()); }
public void SaveControlOption([Values(ControlOption.Arrows, ControlOption.Paddle, ControlOption.Gyroscope)] ControlOption value) { //Arrange Option toSave = new Option() { Name = OptionName.Controls, Value = value }; Option saved; //Act OptionFacade.Save(toSave.Name, toSave.Value); saved = OptionFacade.Find(OptionName.Controls); //Assert Assert.AreEqual(toSave, saved); Assert.AreEqual(toSave.Value, saved.Value); Assert.AreEqual(1, OptionFacade.FindAll().Count, Facade <Option> .ToStringAll()); }
public void Navigate(ControlOption controlOption, object navigateObject = null) { PageControl newControl = null; switch (controlOption) { case ControlOption.EventOverview: case ControlOption.Html: if (navigateObject != null) { newControl = new HtmlControl(navigateObject, this, World, controlOption); } break; case ControlOption.Chart: newControl = new ChartControl(World, navigateObject as DwarfObject, this); break; case ControlOption.Map: newControl = new MapControl(World, navigateObject, this); break; case ControlOption.Search: newControl = new SearchControl(this); break; case ControlOption.ReadMe: newControl = new ReadMeControl(this); break; } if (newControl != null) { if (MakeNewTab()) { TabPages.Add(new DwarfTabPage(newControl)); } else { DwarfTabPage dwarfTabPage = SelectedTab as DwarfTabPage; dwarfTabPage?.NewPageControl(newControl); } } }
private void JacoButtonArrangement(ControlOption myOption) { int visibleButtonCounter = 0; for (int i = 0; i < 9; i++) { bool isGeneral = false; if (myOption.buttonVisible[i]) { ButtonArray[i] = new Button(); ButtonArray[i].Style = (Style)Application.Current.Resources["Pusher"]; ButtonArray[i].Name = "Button" + i.ToString(); ButtonArray[i].Margin = new Thickness(10, 10, 10, 10); //ButtonArray[i].Opacity = new double(); //ButtonArray[i].Opacity = 0.5; StackPanel ButtonContent = new StackPanel(); ButtonContent.HorizontalAlignment = HorizontalAlignment.Center; ButtonContent.Orientation = Orientation.Vertical; if (myOption.buttonUris[visibleButtonCounter] != null) { Image ContentImage = new Image(); ContentImage.Source = new BitmapImage(myOption.buttonUris[visibleButtonCounter]); ContentImage.HorizontalAlignment = HorizontalAlignment.Center; ContentImage.MaxWidth = 50; ButtonContent.Children.Add(ContentImage); } TextBlock ContentText = new TextBlock(); ContentText.Text = myOption.buttonLabels[visibleButtonCounter]; ContentText.HorizontalAlignment = HorizontalAlignment.Center; ButtonContent.Children.Add(ContentText); ButtonArray[i].Content = ButtonContent; string ButtonText = myOption.buttonLabels[visibleButtonCounter]; System.Diagnostics.Debug.WriteLine(ButtonText); switch (ButtonText) { case "Up": Grid.SetColumn(ButtonArray[i], 1); Grid.SetRow(ButtonArray[i], 2); isGeneral = true; break; case "Down": Grid.SetColumn(ButtonArray[i], 1); Grid.SetRow(ButtonArray[i], 4); isGeneral = true; break; case "Left": Grid.SetColumn(ButtonArray[i], 0); Grid.SetRow(ButtonArray[i], 3); isGeneral = true; break; case "Right": Grid.SetColumn(ButtonArray[i], 3); Grid.SetRow(ButtonArray[i], 3); isGeneral = true; break; case "Forward": Grid.SetColumn(ButtonArray[i], 2); Grid.SetRow(ButtonArray[i], 2); isGeneral = true; break; case "Backward": Grid.SetColumn(ButtonArray[i], 2); Grid.SetRow(ButtonArray[i], 4); isGeneral = true; break; case "High": Grid.SetColumn(ButtonArray[i], 4); Grid.SetRow(ButtonArray[i], 4); ButtonArray[i].Name = "Button92"; isGeneral = true; break; case "Medium": Grid.SetColumn(ButtonArray[i], 4); Grid.SetRow(ButtonArray[i], 3); ButtonArray[i].Name = "Button91"; isGeneral = true; break; case "Low": Grid.SetColumn(ButtonArray[i], 4); Grid.SetRow(ButtonArray[i], 2); ButtonArray[i].Name = "Button90"; isGeneral = true; break; } if (!isGeneral) { Grid.SetColumn(ButtonArray[i], i % 3 + 1); Grid.SetRow(ButtonArray[i], i / 3 + 2); } ButtonGrid.Children.Add(ButtonArray[i]); ButtonArray[i].PreviewMouseDown += delegate(object a, MouseButtonEventArgs b) { buttonPressed = true; CheckSound(); ((UCSettings)DataContext).ButtonKey = ((Button)a).Name; }; ButtonArray[i].PreviewMouseUp += delegate(object a, MouseButtonEventArgs b) { buttonPressed = false; ((UCSettings)DataContext).ButtonKey = "ButtonNull"; }; ButtonArray[i].MouseEnter += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { CheckSound(); buttonPressed = true; CheckCenterMouse(); ((UCSettings)DataContext).ButtonKey = ((Button)a).Name; } }; ButtonArray[i].MouseLeave += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { buttonPressed = false; ((UCSettings)DataContext).ButtonKey = "ButtonNull"; } }; visibleButtonCounter++; } } }
private extern byte SetConfigurationNative(ControlOption option, uint value);
#pragma warning disable S4200 // It's OK to have native methods unwrapped in nanoFramework public extern uint GetConfiguration(ControlOption option);
private void LoadOptions() { Debug.Log(Facade <Option> .ToStringAll()); Option sound = OptionFacade.Find(OptionName.Sound); bool soundOn = (OnOffOption)sound.Value == OnOffOption.On ? true : false; Option control = OptionFacade.Find(OptionName.Controls); ControlOption controlId = (ControlOption)control.Value; audio.enabled = soundOn; Toggle[] optionToggles = Options_screen.GetComponentsInChildren <Toggle>(); foreach (Toggle t in optionToggles) { switch (t.name) { case OptionToggle.Sound: t.isOn = soundOn; break; case OptionToggle.Arrow: t.isOn = controlId == ControlOption.Arrows; break; case OptionToggle.Paddle: t.isOn = controlId == ControlOption.Paddle; break; case OptionToggle.Gyroscope: t.isOn = controlId == ControlOption.Gyroscope; break; default: Debug.Log(String.Format("Not set: {0}", t.name)); break; } } Option unlockedLevel = OptionFacade.Find(OptionName.UnlockedLevel); switch ((UnlockedLevelOption)unlockedLevel.Value) { case UnlockedLevelOption.Level_16: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_16.ToString())); goto case UnlockedLevelOption.Level_15; case UnlockedLevelOption.Level_15: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_15.ToString())); goto case UnlockedLevelOption.Level_14; case UnlockedLevelOption.Level_14: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_14.ToString())); goto case UnlockedLevelOption.Level_13; case UnlockedLevelOption.Level_13: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_13.ToString())); goto case UnlockedLevelOption.Level_12; case UnlockedLevelOption.Level_12: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_12.ToString())); goto case UnlockedLevelOption.Level_11; case UnlockedLevelOption.Level_11: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_11.ToString())); goto case UnlockedLevelOption.Level_10; case UnlockedLevelOption.Level_10: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_10.ToString())); goto case UnlockedLevelOption.Level_9; case UnlockedLevelOption.Level_9: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_9.ToString())); goto case UnlockedLevelOption.Level_8; case UnlockedLevelOption.Level_8: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_8.ToString())); goto case UnlockedLevelOption.Level_7; case UnlockedLevelOption.Level_7: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_7.ToString())); goto case UnlockedLevelOption.Level_6; case UnlockedLevelOption.Level_6: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_6.ToString())); goto case UnlockedLevelOption.Level_5; case UnlockedLevelOption.Level_5: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_5.ToString())); goto case UnlockedLevelOption.Level_4; case UnlockedLevelOption.Level_4: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_4.ToString())); goto case UnlockedLevelOption.Level_3; case UnlockedLevelOption.Level_3: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_3.ToString())); goto case UnlockedLevelOption.Level_2; case UnlockedLevelOption.Level_2: UnlockLevel(Level_selection_screen.transform.FindChild(UnlockedLevelOption.Level_2.ToString())); break; default: break; } }
protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.HTML) { //<a href=\"collection#" + attack.ID + "\">" + attack.GetOrdinal(attack.Ordinal) string objectType = ""; int id = 0; if (dObject is EventCollection) { objectType = "collection"; id = (dObject as EventCollection).ID; } else if (dObject.GetType() == typeof(HistoricalFigure)) { objectType = "hf"; id = (dObject as HistoricalFigure).ID; } else if (dObject.GetType() == typeof(Entity)) { objectType = "entity"; id = (dObject as Entity).ID; } else if (dObject.GetType() == typeof(WorldRegion)) { objectType = "region"; id = (dObject as WorldRegion).ID; } else if (dObject.GetType() == typeof(UndergroundRegion)) { objectType = "uregion"; id = (dObject as UndergroundRegion).ID; } else if (dObject.GetType() == typeof(Site)) { objectType = "site"; id = (dObject as Site).ID; } else throw new Exception("Unhandled make link for type: " + dObject.GetType()); string optionString = ""; if (option != ControlOption.HTML) optionString = "-" + option.ToString(); return "<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>"; }
//Every time the selection changes in the CotrolOptions listbox the 3x3 //array of buttons in ButtonGrid is repolpulated. private void SelectionChanged(object sender, SelectionChangedEventArgs e) { ButtonGrid.Children.Clear(); if (ControlOptions.SelectedItem != null) { ButtonArray = new Button[9]; TextBox myTextbox = null; ControlOption myOption = (ControlOption)ControlOptions.SelectedItem; int visibleButtonCounter = 0; //Used to iterate through label array from ControlOption for (int i = 0; i < 9; i++) { ButtonArray[i] = new Button(); if (myOption.buttonVisible[i]) { ButtonArray[i].Style = (Style)Application.Current.Resources["Pusher"]; ButtonArray[i].Name = "Button" + i.ToString(); ButtonArray[i].Margin = new Thickness(10, 10, 10, 10); StackPanel ButtonContent = new StackPanel(); ButtonContent.HorizontalAlignment = HorizontalAlignment.Center; ButtonContent.Orientation = Orientation.Vertical; if (myOption.buttonUris[visibleButtonCounter] != null) { Image ContentImage = new Image(); ContentImage.Source = new BitmapImage(myOption.buttonUris[visibleButtonCounter]); ContentImage.HorizontalAlignment = HorizontalAlignment.Center; ContentImage.MaxWidth = 50; ButtonContent.Children.Add(ContentImage); } TextBlock ContentText = new TextBlock(); ContentText.Text = myOption.buttonLabels[visibleButtonCounter]; ContentText.HorizontalAlignment = HorizontalAlignment.Center; ButtonContent.Children.Add(ContentText); ButtonArray[i].Content = ButtonContent; Grid.SetColumn(ButtonArray[i], i % 3 + 1); Grid.SetRow(ButtonArray[i], i / 3 + 1); ButtonGrid.Children.Add(ButtonArray[i]); ButtonArray[i].PreviewMouseDown += delegate(object a, MouseButtonEventArgs b) { buttonPressed = true; CheckSound(); ((UCSettings)DataContext).ButtonKey = ((Button)a).Name; }; ButtonArray[i].PreviewMouseUp += delegate(object a, MouseButtonEventArgs b) { buttonPressed = false; ((UCSettings)DataContext).ButtonKey = "ButtonNull"; }; ButtonArray[i].MouseEnter += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { CheckSound(); buttonPressed = true; CheckCenterMouse(); ((UCSettings)DataContext).ButtonKey = ((Button)a).Name; } }; ButtonArray[i].MouseLeave += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { buttonPressed = false; ((UCSettings)DataContext).ButtonKey = "ButtonNull"; } }; visibleButtonCounter++; } } if (myOption.textBoxVisible) { myTextbox = new TextBox(); myTextbox.TextWrapping = TextWrapping.Wrap; myTextbox.Name = "TextInput"; myTextbox.FontSize = 36; Grid.SetColumn(myTextbox, 1); Grid.SetRow(myTextbox, 1); Grid.SetColumnSpan(myTextbox, 3); ButtonGrid.Children.Add(myTextbox); foreach (Control curControl in ButtonGrid.Children) { if (curControl.GetType() == HelpButton.GetType()) //Note the bug: If no image added to Button label { if (((TextBlock)((StackPanel)((Button)curControl).Content).Children[1]).Text.Equals("Clear")) { ((Button)curControl).Click += delegate(object a, RoutedEventArgs i) { myTextbox.Text = null; }; ((Button)curControl).MouseEnter += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { CheckSound(); ((Button)a).RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); } }; } } } foreach (Control curControl in ButtonGrid.Children) { if (curControl.GetType() == HelpButton.GetType()) //Note the bug: If no image added to Button label { if (((TextBlock)((StackPanel)((Button)curControl).Content).Children[1]).Text.Equals("Send")) { ((Button)curControl).Click += delegate(object a, RoutedEventArgs i) { NotifyServer(localIP + "Alexa" + "/" + 4, myTextbox.Text, "POST", "text/plain"); }; ((Button)curControl).MouseEnter += delegate(object a, MouseEventArgs b) { if (((UCSettings)DataContext).IsHover) { CheckSound(); ((Button)a).RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); } }; } } } } HeaderPic.Source = new BitmapImage(myOption.actualUri); ((UCSettings)DataContext).Message = myOption.name; } CheckCenterMouse(); }
public static HtmlPrinter GetPrinter(object printObject, World world, ControlOption controlOption) { if (controlOption == ControlOption.EventOverview) { return(new EventOverviewPrinter(printObject as DwarfObject, world)); } Type printType = printObject.GetType(); if (printType == typeof(Battle)) { return(new BattlePrinter(printObject as Battle, world)); } if (printType == typeof(BeastAttack)) { return(new BeastAttackPrinter(printObject as BeastAttack, world)); } if (printType == typeof(Entity)) { return(new EntityPrinter(printObject as Entity, world)); } if (printType == typeof(Era)) { return(new EraPrinter(printObject as Era, world)); } if (printType == typeof(HistoricalFigure)) { return(new HistoricalFigureHtmlPrinter(printObject as HistoricalFigure, world)); } if (printType == typeof(WorldRegion)) { return(new RegionPrinter(printObject as WorldRegion, world)); } if (printType == typeof(SiteConquered)) { return(new SiteConqueredPrinter(printObject as SiteConquered, world)); } if (printType == typeof(Site)) { return(new SitePrinter(printObject as Site, world)); } if (printType == typeof(UndergroundRegion)) { return(new UndergroundRegionPrinter(printObject as UndergroundRegion, world)); } if (printType == typeof(War)) { return(new WarPrinter(printObject as War, world)); } if (printType == typeof(World)) { return(new WorldStatsPrinter(world)); } if (printType == typeof(Artifact)) { return(new ArtifactPrinter(printObject as Artifact, world)); } if (printType == typeof(WorldConstruction)) { return(new WorldConstructionPrinter(printObject as WorldConstruction, world)); } if (printType == typeof(WrittenContent)) { return(new WrittenContentPrinter(printObject as WrittenContent, world)); } if (printType == typeof(DanceForm)) { return(new ArtFormPrinter(printObject as ArtForm, world)); } if (printType == typeof(MusicalForm)) { return(new ArtFormPrinter(printObject as ArtForm, world)); } if (printType == typeof(PoeticForm)) { return(new ArtFormPrinter(printObject as ArtForm, world)); } if (printType == typeof(Structure)) { return(new StructurePrinter(printObject as Structure, world)); } if (printType == typeof(Landmass)) { return(new LandmassPrinter(printObject as Landmass, world)); } if (printType == typeof(MountainPeak)) { return(new MountainPeakPrinter(printObject as MountainPeak, world)); } if (printType == typeof(River)) { return(new RiverPrinter(printObject as River, world)); } if (printType == typeof(Raid)) { return(new RaidPrinter(printObject as Raid, world)); } if (printType == typeof(string)) { return(new StringPrinter(printObject as string)); } throw new Exception("No HTML Printer for type: " + printObject.GetType()); }
public HtmlControl(object htmlObject, DwarfTabControl tabControl, World world, ControlOption controlOption) { _world = world; HtmlObject = htmlObject; _printer = HtmlPrinter.GetPrinter(htmlObject, world, controlOption); Title = _printer.GetTitle(); TabControl = tabControl; }
public void OnCancel() { SetButtonColors(buttonsStartColor); line.SetActive(false); controlOption = ControlOption.NULL; }