public static void LoadInternalLanguages(LocaleManager manager) { manager.Locales.Clear(); for (int i = 0; i < manager.textData.Length; i++) { LocaleData data = JsonMapper.ToObject <LocaleData>(manager.textData[i].text); manager.Locales.Add(data); } if (Directory.Exists(GamePath.LanguagePath())) { DirectoryInfo dir = new DirectoryInfo(GamePath.LanguagePath()); FileInfo[] files = dir.GetFiles(); for (int i = 0; i < files.Length; i++) { Debug.Log("External locale file: " + files[i].FullName); StreamReader reader = new StreamReader(files[i].FullName); LocaleData data = JsonMapper.ToObject <LocaleData>(reader); manager.Locales.Add(data); reader.Close(); } } Debug.Log("Totla locale count: " + manager.Locales.Count); }
public static SafePathResult IsSafePath(GamePath path, int timeOffset, int speed = -1, int delay = 0, Obj_AI_Base unit = null) { var IsSafe = true; var intersections = new List <FoundIntersection>(); var intersection = new FoundIntersection(); foreach (var skillshot in DetectedSkillshots) { if (!skillshot.Evade()) { continue; } var sResult = skillshot.IsSafePath(path, timeOffset, speed, delay, unit); IsSafe = IsSafe && sResult.IsSafe; if (sResult.Intersection.Valid) { intersections.Add(sResult.Intersection); } } if (IsSafe) { return(new SafePathResult(true, intersection)); } var intersetion = intersections.MinOrDefault(o => o.Distance); return(new SafePathResult(false, intersetion.Valid ? intersetion : intersection)); }
public void Clean() { MusicSource.clip = null; IsPlaying = false; CurrentBlockIndex = -1; CurrentTime = 0; while (Buttons.Count > 0) { GameObject target = Buttons[0]; Destroy(target); Buttons.Remove(target); } DirectoryInfo CreatorDir = new DirectoryInfo(GamePath.CreatorPath()); FileInfo[] CreatorFiles = CreatorDir.GetFiles(); for (int i = 0; i < CreatorFiles.Length; i++) { string ext = CreatorFiles[i].Extension; if (ext.ToUpper().Equals(".WAV") || ext.ToUpper().Equals(".OGG") || ((Application.platform.Equals(RuntimePlatform.Android) || Application.platform.Equals(RuntimePlatform.IPhonePlayer)) && ext.ToUpper().Equals(".MP3"))) { GameObject newBtn = Instantiate(BtnTemplate); newBtn.SetActive(true); MusicFileBtn fileBtn = newBtn.GetComponent <MusicFileBtn>(); fileBtn.Index = Buttons.Count; fileBtn.SetData(CreatorFiles[i].FullName, CreatorFiles[i].Name); newBtn.GetComponent <RectTransform>().SetParent(BtnParent); newBtn.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); Buttons.Add(newBtn); } } }
/// <summary> Returns whether the input is valid </summary> public static bool Command(string input) { string command = SplitCommand(input, out string[] args); string[] fileList = null; Game game = TargetGame.Game; switch (game) { case Game.DS3: fileList = LIST_FILE_RANDOM_DS3; break; case Game.Sekiro: fileList = LIST_FILE_RANDOM_SEKIRO; break; } if (TABLE_COMMANDS.TryGetValue(command, out ICommand commandEntry)) { for (int i = 0; i < fileList.Length; i++) { if (File.Exists(GamePath.GetMapStudioPath() + fileList[i])) { commandEntry.Command(game, fileList[i], args); } } return(true); } return(false); }
void Awake() { //InitLoadManager GamePath.SetEditorPath(dataPath); UnityAssetsLoader.Instance().Init(); #if UNITY_EDITOR LoadManager.Instance().SetRootPath(GamePath.editorDataPath); #endif }
private void GamePath_Initalized(object sender, EventArgs e) { var ini = new INIFile(); ini.Load(appconfig + "LauncherConfig.ini"); var gamePath = ini.GetValue("GameConfig", "GameDirectory").ToString(); GamePath.AppendText(gamePath); }
public static GamePath Est(ObjectType type, EquipSlot equip, BodySlot slot) { return(type switch { ObjectType.Equipment => equip switch { EquipSlot.Body => GamePath.GenerateUnchecked("chara/xls/charadb/extra_top.est"), EquipSlot.Head => GamePath.GenerateUnchecked("chara/xls/charadb/extra_met.est"), _ => throw new NotImplementedException() },
public static void ClearnUpdateResDir() { #if !UNITY_WEBPLAYER string toberemovedir = GamePath.GetCachedAssetBundlePath(); if (Directory.Exists(toberemovedir)) { Directory.Delete(toberemovedir, true); } #endif }
/// <summary> /// Returns the hash code for this <see cref="GameModel"/> /// </summary> /// <returns>Hash code for this <see cref="GameModel"/></returns> public override int GetHashCode() { int prime = 31; int result = 1; result = prime * result + Type.GetHashCode(); result = prime * result + (GamePath == null ? 0 : GamePath.GetHashCode()); result = prime * result + (LauncherPath == null ? 0 : LauncherPath.GetHashCode()); return(result); }
public void GetGamePathAssertDoesNotThrowTest() { try { var gameSettings = GamePath.GetGamePath("test-settings"); } catch (Exception ex) { throw new Exception("expected action not to throw, but it did!", ex); } }
private VehicleType _type; //the vehicle type #endregion Fields #region Constructors //the constructor public Vehicle(VehicleType type,float speed,float size, StreetDirection curDir, Street curStreet, Street nextStreet,int curStrNum, GamePath path, AudioClip theHorn) { _type = type; _speed = speed; _size = size; _currentDirection = curDir; _currentStreet = curStreet; _nextStreet = nextStreet; _curStreetNumber = curStrNum; _myPath = path; _horn = theHorn; }
public bool AddFile(RelPath filePath, GamePath gamePath) { if (OptionFiles.TryGetValue(filePath, out var set)) { return(set.Add(gamePath)); } OptionFiles[filePath] = new HashSet <GamePath>() { gamePath }; return(true); }
protected override void Execute(string filePath, string fileName) { string _backupFolderPath = GamePath.GetBackupPath(); Directory.CreateDirectory(_backupFolderPath); string backupFilePath = _backupFolderPath + fileName; if (!File.Exists(backupFilePath)) { File.Copy(filePath, backupFilePath); } }
private static void DrawFileLine(FileInfo file, GamePath path) { ImGui.TableNextColumn(); ImGuiCustom.CopyOnClickSelectable(path); ImGui.TableNextColumn(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextUnformatted($"{( char )FontAwesomeIcon.LongArrowAltLeft}"); ImGui.PopFont(); ImGui.TableNextColumn(); ImGuiCustom.CopyOnClickSelectable(file.FullName); }
protected override void Execute(Game game, string msbName) { string source = GamePath.GetMapStudioPath() + msbName; if (File.Exists(source)) { File.Copy(GamePath.GetBackupPath() + msbName, GamePath.GetMapStudioPath() + msbName, overwrite: true); } else { Console.WriteLine($"{source} backup not found"); } }
protected override void Execute(Game game, string msbName) { string _backupFolderPath = GamePath.GetBackupPath(); Directory.CreateDirectory(_backupFolderPath); string backupFilePath = _backupFolderPath + msbName; if (!File.Exists(backupFilePath)) { File.Copy(GamePath.GetMapStudioPath() + msbName, backupFilePath); } }
protected override void Execute(string filePath, string fileName) { string backupPath = GamePath.GetBackupPath() + fileName; if (File.Exists(backupPath)) { File.Copy(backupPath, filePath, overwrite: true); } else { Console.WriteLine($"{backupPath} backup not found"); } }
private static string ResolvePath(string path, ModManager manager, ModCollection collection) { if (!Penumbra.Config.IsEnabled) { return(path); } var gamePath = new GamePath(path); var ret = collection.Cache?.ResolveSwappedOrReplacementPath(gamePath); ret ??= manager.Collections.ForcedCollection.Cache?.ResolveSwappedOrReplacementPath(gamePath); ret ??= path; return(ret); }
public LauncherPage() { InitializeComponent(); if (LocCulture == "ar") { VTCGrid.FlowDirection = DTCGrid.FlowDirection = PSGrid.FlowDirection = FlowDirection.RightToLeft; } GamePath.SetPath(Game.Path); DisableUpdChecks.IsChecked = Settings.DisableUpdChecks; CloseOnGameRun.IsChecked = Settings.CloseOnGameRun; SSLFix.IsChecked = Settings.SSLFix; DowngradeMode.IsChecked = Settings.DowngradeMode; Communism.IsChecked = Settings.CommunismMode; }
private Directive RemapIni(RawSourceFile source, string gamePath) { var data = File.ReadAllText(source.AbsolutePath); data = data.Replace(GamePath, Consts.GAME_PATH_MAGIC_BACK); data = data.Replace(GamePath.Replace("\\", "\\\\"), Consts.GAME_PATH_MAGIC_DOUBLE_BACK); data = data.Replace(GamePath.Replace("\\", "/"), Consts.GAME_PATH_MAGIC_FORWARD); data = data.Replace(MO2Folder, Consts.MO2_PATH_MAGIC_BACK); data = data.Replace(MO2Folder.Replace("\\", "\\\\"), Consts.MO2_PATH_MAGIC_DOUBLE_BACK); data = data.Replace(MO2Folder.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD); var result = source.EvolveTo <RemappedInlineFile>(); result.SourceData = Encoding.UTF8.GetBytes(data).ToBase64(); return(result); }
/// <summary> /// Determines whether this instance and another specified <see cref="GameModel"/> are the same /// </summary> /// <param name="obj">The object to compare to this instance</param> /// <returns><b>True</b> of the object of the obj parameter is the same as the current instance</returns> public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (!this.GetType().IsAssignableFrom(obj.GetType())) { return(false); } GameModel other = (GameModel)obj; if (!Type.Equals(other.Type)) { return(false); } if (GamePath == null) { if (other.GamePath != null) { return(false); } } else if (!GamePath.Equals(other.GamePath)) { return(false); } if (LauncherPath == null) { if (other.LauncherPath != null) { return(false); } } else if (!LauncherPath.Equals(other.LauncherPath)) { return(false); } return(this.GetHashCode() == obj.GetHashCode()); }
/// <summary> /// 返回资源的路径。 /// 在PC平台下,直接返回GetAssetBundlePath()路径下的资源路径 /// 在iOS平台下先查询iOSAssetPath下,如果资源存在,则返回这个资源,否则再查询 /myapplication.app/目录下。 /// 外部类应该使用这个接口来获取某一个资源的路径 /// 如果updated为true,用以上逻辑,false的情况,只从.app路径里读取 /// </summary> /// <param name="assetName">文件名</param> /// <param name="extname">文件后缀名</param> /// <returns>file://文件路径</returns> public static string GetResourceURL(string assetName, string extname, bool tryCacheFirst) { string cachedDataPath = GamePath.GetCachedAssetBundlePath(); string cachedDataPathFull = null; if (cachedDataPath != null) { cachedDataPath = string.Format("{0}{1}.{2}", cachedDataPath, assetName, extname); cachedDataPathFull = "file:///" + cachedDataPath; } string dataPath = string.Format("{0}{1}.{2}", GamePath.GetLocalAssetPath(), assetName, extname); string dataPathFull = string.Format("{0}{1}.{2}", GamePath.GetLocalAssetPathFullQualified(), assetName, extname); if (tryCacheFirst && cachedDataPath != null) { if (File.Exists(cachedDataPath)) { Debug.Log("[GetResourceURL]dataPath = " + cachedDataPathFull); return(cachedDataPathFull); } } // #if !USE_FINAL_DATA // if (GamePlatform.InEditor) // { // string editorDataPath = string.Format("{0}{1}.{2}", Application.dataPath + "/Binaries/", assetName, extname); // //editor优先使用Binary中的数据 // if (File.Exists(editorDataPath)) // { // //DebugOutPut.Log("dataPath = " + editorDataPath, DebugLogLevel.LogLevel1); // return "file://" + editorDataPath; // } // } // #endif if (File.Exists(dataPath)) { Debug.Log("[GetResourceURL]dataPath = " + dataPathFull); return(dataPathFull); } else { DebugUtil.Error("Can not find dataPath = " + dataPath + "!!!"); } //DebugOutPut.Log("data not found : " + dataPath, DebugLogLevel.LogLevel5); return(null); }
public void Write(DirectoryInfo dir, GamePath originalPath) { var data = Data switch { EqdpFile eqdp => eqdp.WriteBytes(), EqpFile eqp => eqp.WriteBytes(), GmpFile gmp => gmp.WriteBytes(), EstFile est => est.WriteBytes(), ImcFile imc => imc.WriteBytes(), CmpFile cmp => cmp.WriteBytes(), _ => throw new NotImplementedException(), }; DisposeFile(CurrentFile); CurrentFile = TempFile.WriteNew(dir, data, $"_{originalPath.Filename()}"); Changed = false; }
public void LoadList() { CurrentListIndex = 0; while (FileButtons.Count > 0) { FileButton target = FileButtons[0]; Destroy(target.gameObject); FileButtons.Remove(target); } if (!Directory.Exists(GamePath.CreatorPath())) { Directory.CreateDirectory(GamePath.CreatorPath()); } DirectoryInfo CreatorDir = new DirectoryInfo(GamePath.CreatorPath()); FileInfo[] CreatorFiles = CreatorDir.GetFiles(); for (int i = 0, idx = 0; i < CreatorFiles.Length; i++) { string ext = CreatorFiles[i].Extension; bool checkPassed = false; for (int j = 0; j < TWxExtensions.Length; j++) { if (ext.Equals(TWxExtensions[j])) { checkPassed = true; break; } } if (checkPassed && File.Exists(CreatorFiles[i].FullName)) { GameObject newObj = Instantiate(FileObject); newObj.SetActive(true); FileButton fileBtn = newObj.GetComponent <FileButton>(); fileBtn.Index = idx++; fileBtn.FilePath = CreatorFiles[i].FullName; fileBtn.SetText(CreatorFiles[i].Name); newObj.GetComponent <RectTransform>().SetParent(FileObject.transform.parent); newObj.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); FileButtons.Add(fileBtn); } } }
public static void GenerateVehicle(GameObject busPrefab, GamePath path) { if(busPrefab != null){ GameObject vehicle; vehicle = Instantiate(busPrefab, path.GenerationPointPosition ,Quaternion.identity) as GameObject; path.PathStreets[0].VehiclesNumber ++; //vehicle.name = "Street # "+path.PathStreets[0].ID + " # " + path.PathStreets[0].VehiclesNumber; vehicle.name = "Street # "+path.PathStreets[0].ID + " Car number " + GameMaster.vehicilesCounter; // public Vehicle(VehicleType type,float speed,float size, Direction curDir, Street curStreet, Street nextStreet, Path path) vehicle.GetComponent<VehicleController>().myVehicle = new Vehicle( VehicleType.Bus, Globals.BUS_SPEED, MathsCalculatios.getVehicleLargeSize(vehicle), path.PathStreets[0].StreetLight.Type, path.PathStreets[0], path.PathStreets[1], 0, path, null); } }
public static Vector2 PositionAfter(this GamePath self, int t, int speed, int delay = 0) { var distance = Math.Max(0, t - delay) * speed / 1000; for (var i = 0; i <= self.Count - 2; i++) { var from = self[i]; var to = self[i + 1]; var d = (int)to.Distance(from); if (d > distance) { return(from + distance * (to - from).Normalized()); } distance -= d; } return(self[self.Count - 1]); }
private void ChangeGamePath(object Sender, RoutedEventArgs Args) { if (FileExists($@"{GamePath.Text}\ShooterGame\Binaries\Win64\ShooterGame.exe")) { if (ShowOptions("Warning", LocString(LocCode.GamePathPrompt))) { ARKPath = GamePath.Text; Current.Shutdown(); } else { GamePath.SetPath(Game.Path); } } else { Show("Warning", LocString(LocCode.CantUsePath)); GamePath.SetPath(Game.Path); } }
protected override void Execute(Game game, string msbName) { Randomizer.Clear(); string filePath = GamePath.GetMapStudioPath() + msbName; switch (game) { case Game.DS3: MSB3 msb3 = MSB3.Read(filePath); EnemyWrapper.Overwrite(Randomizer.Randomize(EnemyWrapper.Read(msb3.Parts.Enemies).ToList()), msb3.Parts.Enemies); msb3.Write(filePath); break; case Game.Sekiro: MSBS msbs = MSBS.Read(filePath); EnemyWrapper.Overwrite(Randomizer.Randomize(EnemyWrapper.Read(msbs.Parts.Enemies).ToList()), msbs.Parts.Enemies); msbs.Write(filePath); break; } }
/// <summary> Returns whether the input is valid </summary> public static bool Command(string input) { string command = SplitCommand(input, out string[] args); Game game = TargetGame.Game; SelectFileListAndCommandTable(game, out string[] fileList, out Dictionary <string, ICommand> commandTable); if (commandTable.TryGetValue(command, out ICommand commandEntry)) { string filePath; for (int i = 0; i < fileList.Length; i++) { if (File.Exists(filePath = GamePath.GetMapStudioPath() + fileList[i])) { commandEntry.Command(filePath, fileList[i], args); } } return(true); } return(false); }
public void SendToGame() { string sPath = GamePath.SongPath(); DataSender.GetSongData(titleText.text, titleText.text, LevelText[LevelIndex], sPath, CurrentBeatmaps[CurrentIndex].FilePath, CurrentBeatmaps[CurrentIndex].WavPath, CurrentBeatmaps[CurrentIndex].Mp3Path, CurrentBeatmaps[CurrentIndex].OggPath, BGAPath, BackPath); DataSender.GetGameOptionData(autoPlay, noMusic, defBGA, randWave, mirror, curScrollVal, CurBGAVal); DataSender.SetNotemapMode((NotemapMode)CurrentBeatmaps[CurrentIndex].FormatMode); // FormatMode - 0: TW5, 1: SSTrain, 2: Deleste, 3: TW2, 4: TW4, 5: TW6, 6: TW1 if (CurrentBeatmaps[CurrentIndex].FormatMode.Equals(3)) { if (PlayerPrefs.HasKey("theater2") && PlayerPrefs.GetInt("theater2").Equals(0)) { changer.ChangeToScene("2LTheaterP", 0.5f); } else { changer.ChangeToScene("6LineGame", 0.5f); } } else { changer.ChangeToScene("6LineGame", 0.5f); } }
private static void Main(string[] args) { var gameSettings = GamePath.GetGamePath(args[0]); ExecuteGame(gameSettings); }
public void InitStreetAndVehicleAttributes() { _path = myVehicle.MyPath; _street = myVehicle.CurrentStreet; _direction = myVehicle.CurrentDirection; speed = myVehicle.Speed; _size = myVehicle.Size; vehType = myVehicle.Type; _light = _street.StreetLight; _stopPosition = _street.StopPosition; _endPosition = _street.EndPoint; _myQueue = _street.StrQueue; _nextDirection = myVehicle.NextStreet.StreetLight.Type; myRayCastRange = Globals.RAY_CAST_RANGE + _size; if(vehType == VehicleType.Taxi){ taxiStops = Taxi.SetGetTaxiRandomStops(gameMasterScript.gameTime -5, gameMasterScript.gameTime-10); } }
private void DrawFileSwapTabEdit() { if (!ImGui.BeginTabItem(LabelFileSwapTab)) { return; } ImGui.SetNextItemWidth(-1); if (ImGui.BeginListBox(LabelFileSwapHeader, AutoFillSize)) { var swaps = Meta.FileSwaps.Keys.ToArray(); var arrow = $"{( char )FontAwesomeIcon.LongArrowAltRight}"; ImGui.PushFont(UiBuilder.IconFont); var arrowWidth = ImGui.CalcTextSize(arrow).X; ImGui.PopFont(); var width = (ImGui.GetWindowWidth() - arrowWidth - 4 * ImGui.GetStyle().ItemSpacing.X) / 2; for (var idx = 0; idx < swaps.Length + 1; ++idx) { var key = idx == swaps.Length ? GamePath.GenerateUnchecked("") : swaps[idx]; var value = idx == swaps.Length ? GamePath.GenerateUnchecked("") : Meta.FileSwaps[key]; string keyString = key; string valueString = value; ImGui.SetNextItemWidth(width); if (ImGui.InputTextWithHint($"##swapLhs_{idx}", "Enter new file to be replaced...", ref keyString, GamePath.MaxGamePathLength, ImGuiInputTextFlags.EnterReturnsTrue)) { var newKey = new GamePath(keyString); if (newKey.CompareTo(key) != 0) { if (idx < swaps.Length) { Meta.FileSwaps.Remove(key); } if (newKey != string.Empty) { Meta.FileSwaps[newKey] = value; } _selector.SaveCurrentMod(); if (Mod.Enabled) { _selector.ReloadCurrentMod(); } } } if (idx < swaps.Length) { ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextUnformatted(arrow); ImGui.PopFont(); ImGui.SameLine(); ImGui.SetNextItemWidth(width); if (ImGui.InputTextWithHint($"##swapRhs_{idx}", "Enter new replacement path...", ref valueString, GamePath.MaxGamePathLength, ImGuiInputTextFlags.EnterReturnsTrue)) { var newValue = new GamePath(valueString); if (newValue.CompareTo(value) != 0) { Meta.FileSwaps[key] = newValue; _selector.SaveCurrentMod(); if (Mod.Enabled) { _selector.ReloadCurrentMod(); } } } } } ImGui.EndListBox(); } ImGui.EndTabItem(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { //init game options m_GameParameters = new GameOptions(); //game initially starts out in cover menu m_CurrentGameState = GameState.CoverMenu; //init game path m_CurrentGamePath = GamePath.None; //init mouse pointer m_Cursor = new MousePointer(this); Components.Add(m_Cursor); m_ModeSelectString = ""; base.Initialize(); }