void Awake() { //Add all the necessary components LocationHandler locationHandler = gameObject.AddComponent <LocationHandler> (); locationHandler.Init(); //Set up displays m_displays = new Dictionary <string, DisplayHandler>(); DisplayHandler[] displayChildren = gameObject.GetComponentsInChildren <DisplayHandler>(); foreach (DisplayHandler display in displayChildren) { display.Init(); display.HideDisplay(); m_displays.Add(display.DisplayName, display); } m_dramaManager = new DramaManager(Screen.width, Screen.height); currGameState = m_dramaManager.GetRandomStartState(); //Start the display to start with if (m_displays.ContainsKey(displayToStartWith)) { m_currDisplay = displayToStartWith; m_displays[m_currDisplay].SwitchToDisplay(); } else { Debug.LogError("GameplayManager Error: displayToStartWith did not match a Handler name"); } Instance = this; }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LocHandler = new LocationHandler(Activity.GetSystemService(Activity.LocationService) as LocationManager); LocHandler.LocationRequest += (sender, args) => { if (args == LocationHandler.messageType.LOCATION) { // sets the location initially var loc = (Location)sender; if (followPosition) { lastPosition = loc; SetLocation(loc.Latitude, loc.Longitude); } } else if (args == LocationHandler.messageType.DISABLED) { Toast.MakeText(Activity, Resource.String.ENABLE_GPS, ToastLength.Long).Show(); } else if (args == LocationHandler.messageType.ENABLED) { Log.Debug("GPSPROVIDER", "Enabled"); } }; // initializes the LocationHandler and fires an event if any porblems occur LocHandler.Init(); }
public override void OnResume() { base.OnResume(); SetUpMapIfNeeded(); LocHandler.Init(); // needs to be reinitialized maybe }