Beispiel #1
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.S) && Input.GetKey(KeyCode.LeftAlt) && Singleton.playerTank)
     {
         path = Path.GetFullPath(Path.Combine(AdvancedBuildingMod.PreciseSnapshotsFolder, Singleton.playerTank.name + ".json"));
         if (File.Exists(path))
         {
             visible = true;
             return;
         }
         PreciseSnapshot.Save(Singleton.playerTank, AdvancedBuildingMod.PreciseSnapshotsFolder);
     }
 }
Beispiel #2
0
 private void DoWindow(int id)
 {
     GUILayout.Label(new GUIContent("<color=yellow>WARNING</color>"), new GUIStyle {
         richText = true, alignment = TextAnchor.MiddleCenter, fontSize = 32
     });
     GUILayout.Label("The path \"" + path + "\" already exists.\n Do you want to replace it ?");
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Cancel"))
     {
         visible = false;
     }
     if (GUILayout.Button("Overwrite"))
     {
         visible = false;
         PreciseSnapshot.Save(Singleton.playerTank, AdvancedBuildingMod.PreciseSnapshotsFolder);
     }
     GUILayout.EndHorizontal();
 }
Beispiel #3
0
        private void DoWindow(int id)
        {
            scrollPos = GUILayout.BeginScrollView(scrollPos);
            foreach (var tech in Directory.GetFiles(Path.GetFullPath(AdvancedBuildingMod.PreciseSnapshotsFolder), "*.json"))
            {
                if (GUILayout.Button(tech, new GUIStyle(GUI.skin.button)
                {
                    richText = true, alignment = TextAnchor.MiddleLeft
                }))
                {
                    path = tech;
                }
            }
            GUILayout.EndScrollView();
            GUILayout.TextField(path);
            if (GUILayout.Button("Load"))
            {
                try
                {
                    Vector3    position = Singleton.playerTank.trans.position;
                    Quaternion rotation = Singleton.playerTank.trans.rotation;

                    loadedTech = PreciseSnapshot.Load(path, position, rotation);

                    Tank playerTank = Singleton.playerTank;
                    Singleton.Manager <ManTechs> .inst.SetPlayerTank(null, true);

                    playerTank.RemoveFromNetworkedGame();


                    Singleton.Manager <ManTechs> .inst.SetPlayerTank(loadedTech, true);
                }
                catch { }
                visible = false;
            }
            if (GUILayout.Button("Cancel"))
            {
                visible = false;
            }
        }