private static void UpdatePublisher(SqlParameter bookId) { int newPbId = InputHandling.ReadValue("New Publisher Id: "); SqlParameter newPublisherId = new SqlParameter { Value = newPbId, SqlDbType = SqlDbType.Int, ParameterName = "newPublisherId" }; string updatePublisherIdString = "Update BOOK SET PublisherId = @newPublisherId WHERE BookId = @bookId"; SqlCommand updatePublisherCommand = new SqlCommand(updatePublisherIdString, dbBooksConn); updatePublisherCommand.Parameters.Add(bookId); updatePublisherCommand.Parameters.Add(newPublisherId); try { dbBooksConn.Open(); updatePublisherCommand.ExecuteNonQuery(); OutputHandling.Message($"Book price field for book id {bookId} Updated Successfully", ConsoleColor.Green); } catch { OutputHandling.Error("Invalid Book Id"); } finally { dbBooksConn.Close(); } }
static void RunProgram(ref bool programRunning) { // define two linked list objects LinkedList <int> list1 = new LinkedList <int>(); LinkedList <int> list2 = new LinkedList <int>(); int failIndex = 0; int list1Length = InputHandling.ReadCollectionLength("List 1 length: "); InputHandling.ReadCollectionElements(ref list1, list1Length, ref failIndex); failIndex = 0; int list2Length = InputHandling.ReadCollectionLength("List 2 length: "); InputHandling.ReadCollectionElements(ref list2, list2Length, ref failIndex); Sorting.BubbleSort(ref list1); Sorting.BubbleSort(ref list2); LinkedList <int> mergedList = Merge.MergeLinkedList(list1, list2); OutputHandling.Message("First List: ", ConsoleColor.Yellow, false); OutputHandling.PrintLinkedList(list1); OutputHandling.Message("Second List: ", ConsoleColor.Yellow, false); OutputHandling.PrintLinkedList(list2); OutputHandling.Message("Merged Lists: ", ConsoleColor.Yellow, false); OutputHandling.PrintLinkedList(mergedList); OutputHandling.Question("Do you want to merge other two Linked Lists? Y / N"); programRunning = InputHandling.QuestionOptions(); }
/// <summary> /// When Play button is pressed, this event executes /// </summary> private void Play_Click(object sender, RoutedEventArgs e) { if (InputHandling.isNumeric(imageXIndexTextBox, imageYIndexTextBox, SpritesPerColumnTextBox, SpritesPerRowTextBox)) { if ((SpritesPerRowTextBox.Text != "") && (SpritesPerColumnTextBox.Text != "") && (imageYIndexTextBox.Text != "") && (imageXIndexTextBox.Text != "") && (frameCount.Text != "") && (ImageFileNameTextBox.Text != "") && _IsPlaying == false) { _IsPlaying = true; _CurrentPlaying = true; _BackgroundWorker.RunWorkerAsync(); int frameSpeed = (int)(Convert.ToSingle(txtAnimationDuration.Text) * 1000); if (frameSpeed < minSpeed) { txtAnimationDuration.Text = "0.05"; } duration = string.IsNullOrEmpty(txtAnimationDuration.Text) ? 125 : Math.Max(frameSpeed, minSpeed); } else if (_IsPlaying && _CurrentPlaying) { //nothing should happen because its playing so no errors } else { MessageBoxes.Alert_PopUP("Missing field entries"); } } }
private static void UpdateTitle(SqlParameter bookId) { string newBkTitle = InputHandling.ReadString("New book Title: "); SqlParameter newBookTitle = new SqlParameter { Value = newBkTitle, SqlDbType = SqlDbType.VarChar, ParameterName = "newTitle" }; string updateTitleString = "Update BOOK SET Title = @newTitle WHERE BookId = @bookId"; SqlCommand updateTitleCommand = new SqlCommand(updateTitleString, dbBooksConn); updateTitleCommand.Parameters.Add(bookId); updateTitleCommand.Parameters.Add(newBookTitle); try { dbBooksConn.Open(); updateTitleCommand.ExecuteNonQuery(); } catch { OutputHandling.Error("Invalid Book Id"); } finally { dbBooksConn.Close(); } }
/// <summary> /// Defines the input handling for this pack. /// The input handling instructs the storage system how to handle the scanned pack (e.g. input the pack). /// </summary> /// <param name="handling">The handling which describes how to handle the pack.</param> void IInputPack.SetHandling(InputHandling handling) { this.Handling = new Handling() { Input = handling.ToString() }; }
/// <summary> /// Defines the input handling for this pack. /// The input handling for a pack instructs the storage system how to handle the scanned pack (e.g. input the pack). /// </summary> /// <param name="handling"> /// The handling which describes how to handle the pack. /// </param> /// <param name="message"> /// Additional message to show in the UI of the storage system. /// This message is typically used in case of a pack rejection to show a more detailed rejection reason. /// </param> void IInputPack.SetHandling(InputHandling handling, string message) { this.Handling = new Handling() { Input = handling.ToString(), Text = TextConverter.EscapeInvalidXmlChars(message) }; }
private static void PrintTotalBookCostOfPublisher() { Console.Clear(); int pId = InputHandling.ReadValue("Publisher ID: "); OutputHandling.Message(CRUDPublisher.TotalBookCostOfPublisher(pId)); MainMenu(); }
static void RunProgram(ref bool programRunning) { int x = InputHandling.ReadValue("Number to calculate the sum: "); OutputHandling.Message("The sum of the digits of " + x + " is: " + SumOfDigits.Sum(x)); OutputHandling.Question("Do you want to calculate the sum of the digits of another number? Y / N"); programRunning = InputHandling.QuestionOptions(); }
static void Main(string[] args) { int pubId = InputHandling.ReadValue("Publisher Id: "); string pubName = InputHandling.ReadString("Publisher Name: "); PublisherCrud.InsertPublisher(pubId, pubName); Console.ReadKey(); }
static void RunProgram(ref bool programRunning) { int n = InputHandling.ReadValue("Number to print from fibonacci sequence, starting at 1: "); Console.WriteLine(Fibonacci.FindFiboInSequence(n)); OutputHandling.Question("Do you want to find another number in a fibonacci sequence? Y / N"); programRunning = InputHandling.QuestionOptions(); }
static void RunProgram(ref bool programRunning) { int x = InputHandling.ReadValue("Type in a value to calculate it's factorial: "); Console.WriteLine("How do you want to calculate the factorial? R - Recursion, I - Iteration"); Factorial.CalculateFactorial(x); OutputHandling.Question("Do you want to determine the factorial of another number? Y / N"); programRunning = InputHandling.QuestionOptions(); }
void Start() { handleInput= GameObject.Find("GameManager").GetComponent<InputHandling>(); rb = GetComponent<Rigidbody>(); particles = GetComponentInChildren<ParticleSystem>(); }
static void RunProgram(ref bool programRunning) { int n = InputHandling.ReadValue("Number to display set bits: "); int[] nToBase2 = BaseConversion.ConvertBase10ToBaseX(n, 2); OutputHandling.Message("The number of bits that are set for " + n + " is " + SetBits.CountSetBits(n)); OutputHandling.PrintArray(nToBase2, nToBase2.Length, "Representation of " + n + " in base 2 is: ", "", "0b", false); OutputHandling.Question("Do you want to calculate the number of set bits of a nother number? Y / N"); programRunning = InputHandling.QuestionOptions(); }
static void Main(string[] args) { InitConfiguration(); CleanDir(pathTmp); CleanDir(pathRes); Log("Started. Scale: " + scale + " angleStep:" + angleStep + " lstSize: " + lstSize.Width + "x" + lstSize.Height); // Загрузка из PDF и масштабирование //InputHandling.ConvertPDFDirToScaledImg(pathSrc, pathTmp, scale); // Масштабирование Size scaledLstSize = new Size((int)(lstSize.Width * scale), (int)(lstSize.Height * scale)); InputHandling.ScaleWholeDirectory(pathSrc, pathTmp, scale); // Загрузка фигур Console.WriteLine("Starting process. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); List <Figure> data = Figure.LoadFigures(pathTmp, srcFigColor, angleStep, borderDistance, figAmount); data.Sort(Figure.CompareFiguresBySize); Figure.UpdIndexes(data); //Figure.DeleteWrongAngles(scaledLstSize.Width, scaledLstSize.Height, data); SolutionChecker.LoadFigures(data, pathPrologCode, scaleCoefs); Console.WriteLine("Figure loading finished. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); Log("Loaded Figs."); // Поиск решения Console.WriteLine("Starting result finding. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); var preDefArr = SolutionChecker.FindAnAnswer(data, scaledLstSize.Width, scaledLstSize.Height, pathPrologCode, scaleCoefs); var result = SolutionChecker.PlacePreDefinedArrangement(preDefArr, scaledLstSize.Width, scaledLstSize.Height, scaleCoefs); if (result == null) { Log("Prolog finished. No answer."); } else { Log("Prolog finished. Answer was found."); // Отображение решения Console.WriteLine("Starting visualization. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); OutputImage.SaveResult(data, preDefArr, result, pathRes, scaledLstSize.Width, scaledLstSize.Height); OutputText.SaveResult(preDefArr, data, result, pathRes + "result.txt"); } Console.WriteLine("Process finished. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); Log("Finished."); Console.ReadLine(); }
static void RunProgram(ref bool programRunning) { int linkedListLength = InputHandling.ReadCollectionLength("Length of Linked List: "); SingleLinkedList singleLinkedList = new SingleLinkedList(); int failIndex = 0; InputHandling.ReadCollectionElements(ref singleLinkedList, linkedListLength, ref failIndex); ReverseLinkedList.PerformReversal(ref singleLinkedList, ref linkedListLength); OutputHandling.Question("Do you want to reverse another Linked List? Y / N"); programRunning = InputHandling.QuestionOptions(); }
/// <summary> /// reset the image frame back to the beginning /// </summary> private void Stop_ButtonClick(object sender, RoutedEventArgs e) { //Set imgIndex to -1 so the next frame is 0 (the start) if (InputHandling.isNumeric(imageXIndexTextBox, imageYIndexTextBox, SpritesPerColumnTextBox, SpritesPerRowTextBox)) { imgIndex = -1; imgIndex = SpritePreviewer.PlayNextFrame(imgIndex, imageYIndexTextBox, imageXIndexTextBox, frameCount, SpritesPerRowTextBox, ImageFileNameTextBox, SpritesPerColumnTextBox, Test_Img); _CurrentPlaying = false; } }
public static void ReadPublisher() { int pubId = InputHandling.ReadValue("New publisher id: "); string pubName = InputHandling.ReadString("Publisher Name: "); BooksCrud.InsertPublisher(pubId, pubName); //OutputHandling.Question("Do you want to insert another Publisher? Y / N"); //bool isRunning = InputHandling.QuestionOptions(); //if (isRunning) // ReadPublisher(); }
private void button_FindAnswer_Click(object sender, EventArgs e) { if (choseenFigsPath.Count == 0) { MessageBox.Show("Не выбраны детали"); return; } InitConfiguration(); CleanDir(pathTmp); CleanDir(pathRes); // Масштабирование Size scaledLstSize = new Size((int)(lstSize.Width * scale), (int)(lstSize.Height * scale)); InputHandling.ScaleAllFigs(choseenFigsPath, pathTmp, scale); // Загрузка фигур Console.WriteLine("Starting process. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); List <Figure> data = Figure.LoadFigures(pathTmp, srcFigColor, angleStep, borderDistance, figAmount); data.Sort(Figure.CompareFiguresBySize); Figure.UpdIndexes(data); Figure.DeleteWrongAngles(scaledLstSize.Width, scaledLstSize.Height, data); SolutionChecker.LoadFigures(data, pathPrologCode, scaleCoefs); Console.WriteLine("Figure loading finished. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); // Поиск решения Console.WriteLine("Starting result finding. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); var preDefArr = SolutionChecker.FindAnAnswer(data, scaledLstSize.Width, scaledLstSize.Height, pathPrologCode, scaleCoefs); var result = SolutionChecker.PlacePreDefinedArrangement(preDefArr, scaledLstSize.Width, scaledLstSize.Height, scaleCoefs); if (result == null) { MessageBox.Show("Prolog finished. No answer."); } else { MessageBox.Show("Prolog finished. Answer was found."); // Отображение решения Console.WriteLine("Starting visualization. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); OutputImage.SaveResult(data, preDefArr, result, pathRes, scaledLstSize.Width, scaledLstSize.Height); OutputText.SaveResult(preDefArr, data, result, pathRes + "result.txt"); } Console.WriteLine("Process finished. " + DateTime.Now.Minute + ":" + DateTime.Now.Second); Console.ReadLine(); }
public static void TryOverWrite(ref string fileName, Uri uri) { if (File.Exists(fileName)) { OutputHandling.Question($"There is already an existing file called {fileName}. Do you want to overwrite it? Y / N"); if (!InputHandling.QuestionOptions(false)) { Rename(ref fileName, uri); } } }
static void Main(string[] args) { string url = InputHandling.ReadString("Url to download from: "); Downloader.Download(url); OutputHandling.Question("Do you want to download another file? Y / N"); if (InputHandling.QuestionOptions()) { Main(args); } }
static void RunProgram(ref bool programRunning) { int arrLength = InputHandling.ReadCollectionLength(); int[] array = new int[arrLength]; int index = 0; InputHandling.ReadCollectionElements(ref array, arrLength, ref index); Console.WriteLine("The sum of the even array elements is: {0}", CalculateSum.Sum(array, arrLength)); OutputHandling.Question("Do you want to print the sum of other even numbers in an array? Y / N"); programRunning = InputHandling.QuestionOptions(); }
static void RunProgram(ref bool programRunning) { int linkedListLength = InputHandling.ReadValue("Sorted Linked List Length: "); LinkedList <int> linkedList = new LinkedList <int>(); int index = 0; InputHandling.ReadCollectionElements(ref linkedList, linkedListLength, ref index); LinkedListDuplicates.RemoveLinkedListDuplicates(ref linkedList); LinkedListDuplicates.DisplayLinkedList(linkedList); OutputHandling.Question("Do you want to remove duplicates from another sorted Linked List? Y / N"); programRunning = InputHandling.QuestionOptions(); }
/* ============================================================================ Button functions ============================================================================ */ public static bool IsPressed(string key, InputHandling inputHandling) { bool pressed = false; if(key != null && key != "" && ((InputHandling.BUTTON_DOWN.Equals(inputHandling) && Input.GetButtonDown(key)) || (InputHandling.BUTTON_UP.Equals(inputHandling) && Input.GetButtonUp(key)) || (InputHandling.KEY_DOWN.Equals(inputHandling) && Input.GetKeyDown(key)) || (InputHandling.KEY_UP.Equals(inputHandling) && Input.GetKeyUp(key)))) { pressed = true; } return pressed; }
static void RunProgram(ref bool programRunning) { int myListLength = InputHandling.ReadCollectionLength("Singly Linked List Length: "); SingleLinkedList myList = new SingleLinkedList(); int failIndex = 0; InputHandling.ReadCollectionElements(ref myList, myListLength, ref failIndex); int thirdFromEnd = ThirdFromEnd.FindThirdFromEnd(myList); OutputHandling.Message("The third element counting from the end is: " + thirdFromEnd, ConsoleColor.Green); OutputHandling.Question("Do you want to find another third last element of a linked list? Y / N"); programRunning = InputHandling.QuestionOptions(); }
public static bool IsHeld(string key, InputHandling inputHandling) { bool held = false; if(key != null && key != "" && (((InputHandling.BUTTON_DOWN.Equals(inputHandling) || InputHandling.BUTTON_UP.Equals(inputHandling)) && Input.GetButton(key)) || ((InputHandling.KEY_DOWN.Equals(inputHandling) || InputHandling.KEY_UP.Equals(inputHandling)) && Input.GetKey(key)))) { held = true; } return held; }
static void RunProgram(ref bool programRunning) { int arrLength = InputHandling.ReadCollectionLength(); int sum = InputHandling.ReadValue("Input sum: "); int[] array = new int[arrLength]; int index = 0; InputHandling.ReadCollectionElements(ref array, arrLength, ref index); PairsEqualToSum.PrintElements(array, arrLength, sum); OutputHandling.Question("Do you want to check other array if the sum of elements is equal to given elements in an array? Y / N"); programRunning = InputHandling.QuestionOptions(); }
// Use this for initialization void Start() { Debug.Log("Adding to press"); press += StartDrawing; release += StopDrawing; move += Move; #if UNITY_EDITOR || UNITY_STANDALONE_WIN handleInput += _MouseInputHandler; #elif UNITY_ANDROID handleInput += _TouchInputHandler; #endif }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // TODO: Gameloop SceneHandling.handleScene(); //the individual gameloops for the different menus etc should go in their own section of processScene() InputHandling.setInputState(); if (MapHandling.reDraw && SceneHandling.currentScene == SceneHandling.Scenes.Ingame) { MapHandling.layoutTiles(); } base.Update(gameTime); }
static void RunProgram(ref bool programRunning) { int arrLen = InputHandling.ReadCollectionLength(); int[] arr = new int[arrLen]; int index = 0; InputHandling.ReadCollectionElements(ref arr, arrLen, ref index); int[] freqArray = FrequencyOfElements.GenerateFrequencyArray(arr, arrLen); int maxIndex = MaxMinArray.MaxIndex(freqArray, freqArray.Length); OutputHandling.Message("The element with the most occurences inside the array is " + maxIndex, ConsoleColor.Magenta); OutputHandling.Question("Do you want to find another value in an array with the most numbers of occurences? Y / N"); programRunning = InputHandling.QuestionOptions(); }
static void RunProgram(ref bool programRunning) { int arrLen = InputHandling.ReadCollectionLength(); int[] arr = new int[arrLen]; int lastFailIndex = 0; InputHandling.ReadCollectionElements(ref arr, arrLen, ref lastFailIndex); int pivot = InputHandling.ReadCollectionIndex(arrLen, "Set pivot point: "); int[] arrRotated = ArrayManipulation.RotateArray(arr, arrLen, pivot); OutputHandling.PrintArray(arrRotated, arrRotated.Length, "Rotated array: "); OutputHandling.Question("Do you want to rotate another array? Y / N"); programRunning = InputHandling.QuestionOptions(); }
public static void GetPublisherIdId() { int publisherId = InputHandling.ReadValue("Publisher Id to delete: "); BooksCrud.DeletePublisher(publisherId); OutputHandling.Question("Do you want to delete another publisher? Y / N"); if (InputHandling.QuestionOptions()) { GetPublisherIdId(); } else { ProgramFlowHandling.Exit("Thank you... bye!"); dbBooksConn.Dispose(); } }
static void RunProgram(ref bool programRunning) { OutputHandling.Message("This program accepts an array and sorts it using Bubble Sort"); int arrLen = InputHandling.ReadCollectionLength(); int[] arr = new int[arrLen]; int lastFailIndex = 0; InputHandling.ReadCollectionElements(ref arr, arrLen, ref lastFailIndex); Sorting.BubbleSort(ref arr, arrLen); OutputHandling.PrintArray(arr, arrLen, "Sorted array using Bubble sort: "); OutputHandling.Question("Do you want to sort another array with Bubble sort? Y / N"); programRunning = InputHandling.QuestionOptions(); }
public void LoadData() { ArrayList data = XMLHandler.LoadXML(dir+filename); int langs = DataHolder.Languages().GetDataCount(); this.moneyText = new string[langs]; this.timeText = new string[langs]; this.itemCollectionText = new string[langs]; this.itemCollectionYesText = new string[langs]; this.itemCollectionNoText = new string[langs]; this.dialogueOkText = new string[langs]; this.dialogueOkSize = new Vector2[langs]; this.dialogueOkOffset = new Vector2[langs]; this.skillLevelName = new string[langs]; this.moneyCollectionText = new string[langs]; this.moneyCollectionYesText = new string[langs]; this.moneyCollectionNoText = new string[langs]; for(int i=0; i<langs; i++) { this.moneyText[i] = "% Money"; this.timeText[i] = "Time: %"; this.itemCollectionText[i] = "You found % %n!"; this.itemCollectionYesText[i] = "Take"; this.itemCollectionNoText[i] = "Leave"; this.dialogueOkText[i] = "Ok"; this.dialogueOkSize[i] = new Vector2(100, 30); this.dialogueOkOffset[i] = new Vector2(0, 0); this.skillLevelName[i] = "%n Lvl %"; this.moneyCollectionText[i] = "You found % money!"; this.moneyCollectionYesText[i] = "Take"; this.moneyCollectionNoText[i] = "Leave"; } if(data.Count > 0) { foreach(Hashtable entry in data) { if(entry[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMESETTINGS) { if(entry.ContainsKey(XMLHandler.NODES)) { ArrayList subs = entry[XMLHandler.NODES] as ArrayList; foreach(Hashtable val in subs) { if(val[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMESETTING) { if(val.ContainsKey("encryptdata")) encryptData = true; if(val.ContainsKey("acceptkey")) acceptKey = val["acceptkey"] as string; if(val.ContainsKey("cancelkey")) cancelKey = val["cancelkey"] as string; if(val.ContainsKey("verticalkey")) verticalKey = val["verticalkey"] as string; if(val.ContainsKey("horizontalkey")) horizontalKey = val["horizontalkey"] as string; if(val.ContainsKey("scrollspeed")) scrollSpeed = float.Parse((string)val["scrollspeed"]); if(val.ContainsKey("icon")) dialogueOkIconName = val["icon"] as string; if(val.ContainsKey("itemcollectionpos")) itemCollectionPosition = int.Parse((string)val["itemcollectionpos"]); if(val.ContainsKey("pausetime")) pauseTime = true; if(val.ContainsKey("switchplayer")) switchPlayer = true; if(val.ContainsKey("switchonlybp")) switchOnlyBP = true; if(val.ContainsKey("freezepause")) freezePause = true; if(val.ContainsKey("minrandomrange")) minRandomRange = float.Parse((string)val["minrandomrange"]); if(val.ContainsKey("maxrandomrange")) maxRandomRange = float.Parse((string)val["maxrandomrange"]); maxBattleParty = int.Parse((string)val["maxactiveparty"]); cursorTimeout = float.Parse((string)val["cursortimeout"]); if(val.ContainsKey("clicktimeout")) { clickTimeout = float.Parse((string)val["clicktimeout"]); } gameControl = (GameControl)System.Enum.Parse( typeof(GameControl), (string)val["gamecontrol"]); dialogueOkPosition = (ButtonPosition)System.Enum.Parse( typeof(ButtonPosition), (string)val["dialogueokposition"]); if(val.ContainsKey("guisystemtype")) { guiSystemType = (GUISystemType)System.Enum.Parse( typeof(GUISystemType), (string)val["guisystemtype"]); } if(val.ContainsKey("guifiltermode")) { guiFilterMode = (FilterMode)System.Enum.Parse( typeof(FilterMode), (string)val["guifiltermode"]); } if(val.ContainsKey("guiimagestretch")) { guiImageStretch = (GUIImageStretch)System.Enum.Parse( typeof(GUIImageStretch), (string)val["guiimagestretch"]); } if(val.ContainsKey("battletexturedelete")) { battleTextureDelete = (TextureDelete)System.Enum.Parse( typeof(TextureDelete), (string)val["battletexturedelete"]); } if(val.ContainsKey("menutexturedelete")) { menuTextureDelete = (TextureDelete)System.Enum.Parse( typeof(TextureDelete), (string)val["menutexturedelete"]); } if(val.ContainsKey("mipmapbias")) mipMapBias = float.Parse((string)val["mipmapbias"]); if(val.ContainsKey("preloadfonts")) preloadFonts = true; if(val.ContainsKey("preloadboxes")) preloadBoxes = true; if(val.ContainsKey("preloadareanames")) preloadAreaNames = true; if(val.ContainsKey("noscrollbar")) noScrollbar = true; if(val.ContainsKey("noscrollbarthumb")) noScrollbarThumb = true; if(val.ContainsKey("noautocollapse")) noAutoCollapse = true; if(val.ContainsKey("hudrefreshframe")) hudRefreshFrame = true; if(val.ContainsKey("autoremovelayer")) autoRemoveLayer = true; if(val.ContainsKey("loopskilllevels")) loopSkillLevels = true; if(val.ContainsKey("addskilllevel")) addSkillLevel = true; if(val.ContainsKey("itemcollectionchoice")) itemCollectionChoice = true; if(val.ContainsKey("moneycollectionchoice")) moneyCollectionChoice = true; if(val.ContainsKey("hudrefreshrate")) { hudRefreshRate = float.Parse((string)val["hudrefreshrate"]); } if(val.ContainsKey("maxclickdistance")) { maxClickDistance = int.Parse((string)val["maxclickdistance"]); } if(val.ContainsKey("areanamepos")) { this.showAreaNames = true; this.areaNamePosition = int.Parse((string)val["areanamepos"]); this.areaNameVisibleTime = float.Parse((string)val["areanametime"]); } if(val.ContainsKey("inputhandling")) { this.inputHandling = (InputHandling)System.Enum.Parse( typeof(InputHandling), (string)val["inputhandling"]); } if(val.ContainsKey("playercomponents")) { this.playerComponent = new string[int.Parse((string)val["playercomponents"])]; } if(val.ContainsKey("spawndistance")) { this.spawnParty = true; this.spawnDistance = float.Parse((string)val["spawndistance"]); BoolHelper.FromHashtable(val, "onlyinbattlearea", ref this.onlyInBattleArea); BoolHelper.FromHashtable(val, "spawnonlybp", ref this.spawnOnlyBP); } if(val.ContainsKey("partyfollow")) { this.partyFollow = true; } if(val.ContainsKey("guiscalemode")) { guiScaleMode = (GUIScaleMode)System.Enum.Parse( typeof(GUIScaleMode), (string)val["guiscalemode"]); } ArrayList s = val[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht in s) { if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DIALOGUEOK) { int i = int.Parse((string)ht["id"]); if(i < langs) { dialogueOkSize[i] = new Vector2(float.Parse((string)ht["width"]), float.Parse((string)ht["height"])); dialogueOkOffset[i] = new Vector2(float.Parse((string)ht["x"]), float.Parse((string)ht["y"])); dialogueOkText[i] = ht[XMLHandler.CONTENT] as string; } } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DIALOGUEOKICON) { dialogueOkIconName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DEFAULTSCREEN) { defaultScreen.x = float.Parse((string)ht["width"]); defaultScreen.y = float.Parse((string)ht["height"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CURSORAUDIO) { this.cursorMoveAudio = ht[XMLHandler.CONTENT] as string; this.cursorMoveVolume = float.Parse((string)ht["volume"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ACCEPTAUDIO) { this.acceptAudio = ht[XMLHandler.CONTENT] as string; this.acceptVolume = float.Parse((string)ht["volume"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CANCELAUDIO) { this.cancelAudio = ht[XMLHandler.CONTENT] as string; this.cancelVolume = float.Parse((string)ht["volume"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.FAILAUDIO) { this.failAudio = ht[XMLHandler.CONTENT] as string; this.failVolume = float.Parse((string)ht["volume"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLLEVELAUDIO) { this.skillLevelAudio = ht[XMLHandler.CONTENT] as string; this.skillLevelVolume = float.Parse((string)ht["volume"]); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMEOVER) { this.gameOver.scene = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONTEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.itemCollectionText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONYESTEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.itemCollectionYesText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONNOTEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.itemCollectionNoText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DROPSETTINGS) { this.saveDrops = bool.Parse((string)ht["save"]); if(ht.ContainsKey("dropmask")) { this.dropOnGround = true; this.dropMask = int.Parse((string)ht["dropmask"]); } this.dropOffsetX = new Vector2(float.Parse((string)ht["x1"]), float.Parse((string)ht["x2"])); this.dropOffsetY = new Vector2(float.Parse((string)ht["y1"]), float.Parse((string)ht["y2"])); this.dropOffsetZ = new Vector2(float.Parse((string)ht["z1"]), float.Parse((string)ht["z2"])); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ACCEPTKEY) { this.acceptKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CANCELKEY) { this.cancelKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.VERTICALKEY) { this.verticalKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.HORIZONTALKEY) { this.horizontalKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYTEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.moneyText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYICON) { this.moneyIconName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.TIMETEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.timeText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.TIMEICON) { this.timeIconName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLPLUSKEY) { this.skillPlusKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLMINUSKEY) { this.skillMinusKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLLEVELNAME) { int i = int.Parse((string)ht["id"]); if(i < langs) this.skillLevelName[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CHARPLUSKEY) { this.charPlusKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CHARMINUSKEY) { this.charMinusKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PLAYERCOMPONENT) { int i = int.Parse((string)ht["id"]); if(i < this.playerComponent.Length) this.playerComponent[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PLAYERCONTROLSETTINGS) { this.playerControlSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CAMERACONTROLSETTINGS) { this.cameraControlSettings.SetData(ht); this.cameraControlSettings.mouseTouch.mode = MouseTouch.MOVE; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYPREFAB) { this.moneyPrefabName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONTEXT) { int i = int.Parse((string)ht["id"]); if(i < langs) this.moneyCollectionText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONYES) { int i = int.Parse((string)ht["id"]); if(i < langs) this.moneyCollectionYesText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONNO) { int i = int.Parse((string)ht["id"]); if(i < langs) this.moneyCollectionNoText[i] = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONANIMATION) { this.itemCollectionAnimation = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PAUSEKEY) { this.pauseKey = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.INTERACTIONCONTROLLER) { this.addInteractionController = true; this.interactionControllerName = ht[XMLHandler.CONTENT] as string; this.interactionControllerOffset = VectorHelper.FromHashtable(ht); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.INTERACTIONCONTROLLERCHILD) { this.interactionControllerChildName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.STATISTIC) { this.statistic.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMEOVERSETTINGS) { this.gameOver.SetData(ht); } } } } } } } } }
public void SetData(Hashtable ht) { this.inputHandling = (InputHandling)System.Enum.Parse( typeof(InputHandling), (string)ht["inputhandling"]); this.axisTimeout = float.Parse((string)ht["axistimeout"]); if(ht.ContainsKey("attacks")) { int count = int.Parse((string)ht["attacks"]); this.attackKey = new string[count]; this.attackAir = new bool[count]; this.attackAxis = new bool[count]; this.attackTrigger = new float[count]; this.attackSpeed = new float[count]; } if(ht.ContainsKey("skills")) { int count = int.Parse((string)ht["skills"]); this.skillID = new int[count]; this.skillKey = new string[count]; this.skillAir = new bool[count]; this.skillAxis = new bool[count]; this.skillTrigger = new float[count]; this.skillSpeed = new float[count]; } if(ht.ContainsKey("items")) { int count = int.Parse((string)ht["items"]); this.itemID = new int[count]; this.itemKey = new string[count]; this.itemAir = new bool[count]; this.itemAxis = new bool[count]; this.itemTrigger = new float[count]; this.itemSpeed = new float[count]; } if(ht.ContainsKey(XMLHandler.NODES)) { ArrayList s = ht[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht2 in s) { if(ht2[XMLHandler.NODE_NAME] as string == CharacterControlMap.ATTACK) { int id = int.Parse((string)ht2["id"]); if(id < this.attackKey.Length) { this.attackKey[id] = ht2[XMLHandler.CONTENT] as string; if(ht2.ContainsKey("axis")) { this.attackAxis[id] = true; this.attackTrigger[id] = float.Parse((string)ht2["axis"]); } if(ht2.ContainsKey("air")) this.attackAir[id] = true; if(ht2.ContainsKey("speed")) { this.attackSpeed[id] = float.Parse((string)ht2["speed"]); } } } else if(ht2[XMLHandler.NODE_NAME] as string == CharacterControlMap.SKILL) { int id = int.Parse((string)ht2["id"]); if(id < this.skillID.Length) { this.skillID[id] = int.Parse((string)ht2["id2"]); this.skillKey[id] = ht2[XMLHandler.CONTENT] as string; if(ht2.ContainsKey("axis")) { this.skillAxis[id] = true; this.skillTrigger[id] = float.Parse((string)ht2["axis"]); } if(ht2.ContainsKey("air")) this.skillAir[id] = true; if(ht2.ContainsKey("speed")) { this.skillSpeed[id] = float.Parse((string)ht2["speed"]); } } } else if(ht2[XMLHandler.NODE_NAME] as string == CharacterControlMap.ITEM) { int id = int.Parse((string)ht2["id"]); if(id < this.itemID.Length) { this.itemID[id] = int.Parse((string)ht2["id2"]); this.itemKey[id] = ht2[XMLHandler.CONTENT] as string; if(ht2.ContainsKey("axis")) { this.itemAxis[id] = true; this.itemTrigger[id] = float.Parse((string)ht2["axis"]); } if(ht2.ContainsKey("air")) this.itemAir[id] = true; if(ht2.ContainsKey("speed")) { this.itemSpeed[id] = float.Parse((string)ht2["speed"]); } } } } } }