private bool CanSpawnBox() { DateTime date; if (GameManager.instance.isTutorialNow) { return(false); } if (!TimeManager.gotDateTime) { DataLoader.gui.secretAnimator.SetBool("IsOpened", false); return(false); } if (PlayerPrefs.HasKey(StaticConstants.MoneyBoxKey)) { DateTime time2 = new DateTime(Convert.ToInt64(PlayerPrefs.GetString(StaticConstants.MoneyBoxKey)), DateTimeKind.Utc); date = time2.Date; } else { if (StaticConstants.NeedInternetConnection) { return(StaticConstants.IsConnectedToInternet()); } return(true); } if (DateTime.Compare(TimeManager.CurrentDateTime.Date, date) == 0) { UnityEngine.Debug.Log("You already got MoneyBox today"); return(false); } return(true); }
// Start is called before the first frame update void Start() { inputCommands = new Dictionary <string, KeyCode>(); inputAxis = new Dictionary <string, string>(); inputDirections = new Dictionary <string, char>(); // Clear commands ClearCommands(); // TODO: name check //var names = Input.GetJoystickNames(); //foreach (var name in names) //{ // Debug.Log(name); //} var joypadConfigurationLines = joypadConfiguration.text.Split('\n'); foreach (string line in joypadConfigurationLines) { var joypadConfigurationWords = line.Split('_', '='); if (joypadConfigurationWords.Length != 3) { continue; } var p = joypadConfigurationWords[0].Trim(); var c = joypadConfigurationWords[1].Trim(); var i = joypadConfigurationWords[2].Trim(); if (p != StaticConstants.PLAYER1_ID || !inputCommands.ContainsKey(c)) { continue; } inputCommands[c] = StaticConstants.StringToKey(i); if (inputCommands[c] == KeyCode.None) { inputAxis[c] = i.Substring(0, i.Length - 1); inputDirections[c] = i[i.Length - 1]; } } }
void ReoloadCommands() { StreamReader reader = new StreamReader(path); var joypadConfiguration = reader.ReadToEnd(); reader.Close(); foreach (string command in StaticConstants.CMD_LIST) { inputTexts[command].text = "None"; } var joypadConfigurationLines = joypadConfiguration.Split('\n'); foreach (string line in joypadConfigurationLines) { var joypadConfigurationWords = line.Split('_', '='); if (joypadConfigurationWords.Length != 3 || joypadConfigurationWords[0] != StaticConstants.PLAYER_LIST[currentPlayer] || !inputTexts.ContainsKey(joypadConfigurationWords[1])) { continue; } string key = joypadConfigurationWords[2].Trim(); try { var keyCode = StaticConstants.StringToKey(key); if (keyCode == KeyCode.None) { Input.GetAxis(key.Substring(0, key.Length - 1)); } } catch (ArgumentException) { key = "None"; } inputTexts[joypadConfigurationWords[1]].text = key; } }