public void OnApplicationFocus(bool focus) { if (isLoaded && focus) { RoomModeSwitcher.OnApplicationFocus(focus); } }
private void CreateRoomModeSwitcher() { if (roomModeSwitcher == null) { roomModeSwitcher = new RoomModeSwitcher(ROOM_MODE_SWITCH_INTERVAL, this); } }
public void InitSave() { roomMode = RoomMode.normal; roomManager.InitSave(); dailyRewardManager.InitSave(); searchCounter = 0; lastSearchRoomId = string.Empty; RoomModeSwitcher.InitSave(); isLoaded = true; }
public bool Load(string saveStr) { if (string.IsNullOrEmpty(saveStr)) { InitSave(); } else { UXMLDocument document = new UXMLDocument(); document.Parse(saveStr); UXMLElement gameModeElement = document.Element(saveId); roomMode = gameModeElement?.GetEnum <RoomMode>("room_mode") ?? RoomMode.normal; UXMLElement roomsElement = gameModeElement.Element("rooms"); if (roomsElement != null) { roomManager.Load(roomsElement); } else { roomManager.InitSave(); } UXMLElement dailyRewardElement = gameModeElement.Element("daily_reward"); if (dailyRewardElement != null) { dailyRewardManager.Load(dailyRewardElement); } else { dailyRewardManager.InitSave(); } searchCounter = gameModeElement.GetInt("search_counter", 0); lastSearchRoomId = gameModeElement.GetString("last_search_room", string.Empty); UXMLElement roomModeSwitcherElement = gameModeElement.Element("room_mode_switcher"); if (roomModeSwitcherElement != null) { RoomModeSwitcher.Load(roomModeSwitcherElement); } else { RoomModeSwitcher.InitSave(); } isLoaded = true; } return(true); }
public string GetSave() { UXMLWriteElement writeElement = new UXMLWriteElement(saveId); writeElement.AddAttribute("room_mode", roomMode.ToString()); writeElement.AddAttribute("search_counter", searchCounter); writeElement.AddAttribute("last_search_room", lastSearchRoomId); writeElement.Add(roomManager.GetSave()); writeElement.Add(dailyRewardManager.GetSave()); writeElement.Add(RoomModeSwitcher.GetSave()); return(writeElement.ToString()); }
public override void Update() { base.Update(); updateCollectableTimer -= Time.deltaTime; if (updateCollectableTimer <= 0.0f) { updateCollectableTimer += 1.0f; if (!collectableViewStarted && receivedCollectables.Count > 0) { var data = receivedCollectables.Dequeue(); collectableViewStarted = true; StartCoroutine(CorShowReceivedCollectables(data)); } } dailyRewardManager.Update(); RoomModeSwitcher.Update(); }