public void goToPreviousEvent() { GUI_Main comp = this.GetComponent <GUI_Main>() as GUI_Main; Evvent PreviousEvent = StoryLine[0]; double DeltaSmallest = double.MaxValue; DateTime currentDate = this.currentClosestEvent.Date; foreach (Evvent currentEvent in StoryLine) { if (currentEvent != this.currentClosestEvent) { if ((this.SelectedTome == this.TheDatabase.TomeDict["ASOIAF"]) || (currentEvent.Book == this.SelectedTome)) { //We consider only evvents for selected Tome! if (currentEvent.Date < currentDate) { double delta = (currentEvent.Date - currentDate).TotalSeconds; if (delta < 0) { delta *= -1; } if (delta < DeltaSmallest) { DeltaSmallest = delta; PreviousEvent = currentEvent; } } } } } this.currentClosestEvent = PreviousEvent; comp.ScrollValueREAL = convertDateToRatio(this.currentClosestEvent.Date); }
void Update() { GUI_Main comp = this.GetComponent <GUI_Main>() as GUI_Main; //Debug.Log (comp.ScrollValue); if (this.SelectedTome == this.TheDatabase.TomeDict["ASOIAF"]) { updateCharacters(comp.ScrollValueREAL); //this.currentDate = convertRatioToDate(comp.ScrollValue); this.currentClosestEvent = this.getCurrentEvent(); } else { double LocalTimeRatio = comp.ScrollValueREAL; // ScrollValue means the ratio for current selected TOme, // so we have to convert it to a maximum update DateTime TheDate = convertRatioToDate(comp.ScrollValueREAL); //float GlobalTimeRAtio = convertDateToRatio(TheDate); Tome MasterTome = this.TheDatabase.TomeDict["ASOIAF"]; //TODO: create a method that returns the MasterTome. int DateNumbers = (TheDate - MasterTome.Start).Days; int TotalNumbers = (MasterTome.End - MasterTome.Start).Days; double GlobalTimeRAtio = (DateNumbers / (double)TotalNumbers); updateCharacters(GlobalTimeRAtio); //this.currentDate = TheDate; this.currentClosestEvent = this.getCurrentEvent(); } //Debug.Log ("Closest is ="+this.currentClosestEvent.Name ); }
void InitializeClasses() { gui_Main.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_Settings.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_Levels.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_Time.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_Boards.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_GameRegular.GetComponent <RectTransform>().localPosition = Vector3.zero; gui_GameTimed.GetComponent <RectTransform>().localPosition = Vector3.zero; GUI_Main.UpdateValues(gui_Main); GUI_Settings.UpdateValues(gui_Settings); GUI_Levels.UpdateValues(gui_Levels); GUI_Time.UpdateValues(gui_Time); GUI_Boards.UpdateValues(gui_Boards); GUI_GameRegular.UpdateValues(gui_GameRegular); GUI_GameTimed.UpdateValues(gui_GameTimed); gui_Main.gameObject.SetActive(true); gui_Settings.gameObject.SetActive(false); gui_Levels.gameObject.SetActive(false); gui_Time.gameObject.SetActive(false); gui_Boards.gameObject.SetActive(false); gui_GameRegular.gameObject.SetActive(false); gui_GameTimed.gameObject.SetActive(false); }
void Start() { Vector3 angles = transform.eulerAngles; x = angles.y; y = angles.x; gui = guiObject.GetComponent <GUI_Main> (); // Set target direction to the camera's initial orientation. targetDirection = transform.localRotation.eulerAngles; // Set target direction for the character body to its inital state. if (characterBody) { targetCharacterDirection = characterBody.transform.localRotation.eulerAngles; } }
public void goToNextEvent() //public Evvent getNextEvent() { GUI_Main comp = this.GetComponent <GUI_Main>() as GUI_Main; //Debug.Log ("current Event found is "+currentClosestEvent.Name+" @="+comp.ScrollValueREAL+" "+currentClosestEvent.Date.ToString("dd MMM HH:mm:ss")); Evvent NextEvent = StoryLine[0]; double DeltaSmallest = double.MaxValue; DateTime currentDate = this.currentClosestEvent.Date; foreach (Evvent currentEvent in StoryLine) { if (currentEvent != this.currentClosestEvent) { if ((this.SelectedTome == this.TheDatabase.TomeDict["ASOIAF"]) || (currentEvent.Book == this.SelectedTome)) { //We consider only evvents for selected Tome! if (currentEvent.Date > currentDate) { double delta = (currentEvent.Date - currentDate).TotalSeconds; if (delta < 0) { delta *= -1; } if (delta < DeltaSmallest) { DeltaSmallest = delta; NextEvent = currentEvent; } } } } } this.currentClosestEvent = NextEvent; comp.ScrollValueREAL = convertDateToRatio(this.currentClosestEvent.Date); //Debug.Log ("Next Event found is "+NextEvent.Name+" @="+comp.ScrollValueREAL+" "+NextEvent.Date.ToString("dd MMM HH:mm:ss")); //Debug.Log ("====================="); }
public void start() { GUI_Main view = new GUI_Main(fachkonzept); view.ShowDialog(); }