public static void TimeTrialProcess(string level) { float t = timeTrialSaved; float tBest = t; if (TimeTrial.Exists(level)) { float lastT = TimeTrial.Load(level); if (t < lastT) { tBest = t; TimeTrial.Save(level, t); } else { tBest = lastT; } } else { tBest = t; TimeTrial.Save(level, t); } //post TimeTrial.Post(level, t); }
protected override void OnOpen() { //save data if best string level = LevelController.levelLoaded; float t = LevelController.timeTrialSaved; float tBest; bool isBest; if (TimeTrial.Exists(level)) { float lastT = TimeTrial.Load(level); if (t < lastT) { tBest = t; isBest = true; //TimeTrial.Save(level, t); } else { tBest = lastT; isBest = false; } } else { tBest = t; isBest = true; //TimeTrial.Save(level, t); } timeLabel.text = LevelController.LevelTimeFormat(t); timeBestLabel.text = LevelController.LevelTimeFormat(tBest); newRecordGO.SetActive(isBest); //post //TimeTrial.Post(level, t); NGUILayoutBase.RefreshNow(transform); }
IEnumerator DoWait() { yield return(StartCoroutine(Achievement.instance.WaitServiceComplete())); waitGO.SetActive(false); UICamera.selectedObject = items[0].l.gameObject; for (int i = 0; i < items.Length; i++) { items[i].l.onClick = OnItemClick; //check locked bool isLocked; if (TimeTrial.instance.data[i].requireUnlock) { if (!Achievement.instance.AchievementIsUnlocked(TimeTrial.instance.data[i].achieveId)) { isLocked = true; //go through slot data ModalSaveSlots modalSlots = UIModalManager.instance.ModalGetController <ModalSaveSlots>("slots"); for (int s = 0; s < modalSlots.slots.Length; s++) { SceneState.instance.ResetGlobalValues(); UserSlotData.LoadSlot(s, false); if (LevelController.IsLevelComplete(TimeTrial.instance.data[i].level)) { isLocked = false; break; } UserSlotData.LoadSlot(-1, false); } } else { isLocked = false; } } else { isLocked = false; } if (isLocked) { items[i].label.text = "?????"; items[i].label.color = Color.gray; items[i].time.text = "BEST - ---:--.--"; items[i].locked = true; } else { items[i].label.text = TimeTrial.instance.data[i].name; items[i].label.color = activeColor; if (TimeTrial.Exists(TimeTrial.instance.data[i].level)) { items[i].time.text = "BEST - " + LevelController.LevelTimeFormat(TimeTrial.Load(TimeTrial.instance.data[i].level)); } else { items[i].time.text = "BEST - ---:--.--"; } items[i].locked = false; } } back.onClick = OnReturn; }