Exemplo n.º 1
0
 public static void SaveWindowSettings()
 {
     if (_mainWindowSettingsSave != null)
     {
         bool ret = Saves.Save(Paths.APP_NAME, "MainWindowSettings", _mainWindowSettingsSave);//todo make async
     }
 }
Exemplo n.º 2
0
 public IEnumerator LogicController(int lmid)
 {
     if (lmid == 0)
     {
         string[] tags = new string[] { "Player", "Enemy", "InstantDamage", "GenericInteraction",
                                        "Type 1 UI", "Logic", "MapSet", "MenuSet", "Canvas" };
         GameManager.sweeperScript.DestroyObjects(tags);
         Saves.Load();
         GameState.Current = Saves.saveStates[0];
         GameObject player1 = Instantiate(GameManager.boardScript.players[1], new Vector3(GameState.Current.Player1Serial.xPos, GameState.Current.Player1Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player2 = Instantiate(GameManager.boardScript.players[2], new Vector3(GameState.Current.Player2Serial.xPos, GameState.Current.Player2Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player3 = Instantiate(GameManager.boardScript.players[3], new Vector3(GameState.Current.Player3Serial.xPos, GameState.Current.Player3Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player4 = Instantiate(GameManager.boardScript.players[4], new Vector3(GameState.Current.Player4Serial.xPos, GameState.Current.Player4Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player5 = Instantiate(GameManager.boardScript.players[5], new Vector3(GameState.Current.Player5Serial.xPos, GameState.Current.Player5Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player6 = Instantiate(GameManager.boardScript.players[6], new Vector3(GameState.Current.Player6Serial.xPos, GameState.Current.Player6Serial.yPos), Quaternion.identity) as GameObject;
         GameObject player7 = Instantiate(GameManager.boardScript.players[7], new Vector3(GameState.Current.Player7Serial.xPos, GameState.Current.Player7Serial.yPos), Quaternion.identity) as GameObject;
         GameManager.boardScript.BoardController(GameState.Current.BMID);
         yield break;
     }
     if (lmid == 1)
     {
         string[] tags = new string[] { "Player", "Enemy", "InstantDamage", "GenericInteraction",
                                        "Type 1 UI", "Logic", "MapSet", "MenuSet", "Canvas" };
         GameManager.sweeperScript.DestroyObjects(tags);
         if (File.Exists(@"C:\Users\marsh\Documents\BackGround Project\Assets\MyTutorialGame\References/savedGames.gd"))
         {
             Debug.Log("Method: LogicManager.LogicController -" + "logic reference list todo" + "(" + lmid + ")" + " - Deleting Current Save File");
             File.Delete(@"C:\Users\marsh\Documents\BackGround Project\Assets\MyTutorialGame\References/savedGames.gd");
         }
         Debug.Log("Method: LogicManager.LogicController -" + "logic reference list todo" + "(" + lmid + ")" + " - Creating New Save File");
         GameObject player1 = Instantiate(GameManager.boardScript.players[1], new Vector3(0, 0), Quaternion.identity) as GameObject;
         GameObject player2 = Instantiate(GameManager.boardScript.players[2], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameObject player3 = Instantiate(GameManager.boardScript.players[3], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameObject player4 = Instantiate(GameManager.boardScript.players[4], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameObject player5 = Instantiate(GameManager.boardScript.players[5], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameObject player6 = Instantiate(GameManager.boardScript.players[6], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameObject player7 = Instantiate(GameManager.boardScript.players[7], new Vector3(-20, -20), Quaternion.identity) as GameObject;
         GameState.Current      = new GameState();
         GameState.Current.BMID = 1;
         GameManager.boardScript.BoardController(GameState.Current.BMID);
         Debug.Log("Method: LogicManager.LogicController -" + "logic reference list todo" + "(" + lmid + ")" + " - Complete");
         yield break;
     }
     if (lmid == 2)
     {
         GameState.Current.Player1Serial = Player1Controller.player1Serial;
         GameState.Current.Player2Serial = Player2Controller.player2Serial;
         GameState.Current.Player3Serial = Player3Controller.player3Serial;
         GameState.Current.Player4Serial = Player4Controller.player4Serial;
         GameState.Current.Player5Serial = Player5Controller.player5Serial;
         GameState.Current.Player6Serial = Player6Controller.player6Serial;
         GameState.Current.Player7Serial = Player7Controller.player7Serial;
         GameState.Current.BMID          = 1;
         GameState.Current.Location      = "Not Implemented";
         GameState.Current.DateTime      = System.DateTime.Now.ToString();
         Saves.Save();
     }
     yield break;
 }
    IEnumerator Muerte()
    {
        vivo  = !vivo;
        dying = !dying;
        enemyScript.End();
        if (porcentaje >= 99.6f)
        {
            GetComponent <SpriteRenderer>().sprite = winSprite;
        }
        else
        {
            GetComponent <SpriteRenderer>().sprite = muerteSprite;
        }
        if (porcentaje > bestScore[level])
        {
            bestScore[level]    = porcentaje;
            bestPosition[level] = transform.position.x;
            saves.Save(this);
        }
        if (level > 0 && monedas > maxMonedas[level])
        {
            if (porcentaje >= 99.6f || testing)
            {
                if (monedas > 4 && setMonedas[level] < 3)
                {
                    setMonedas[level]++;
                    maxMonedas[level] = 0;
                }
                else
                {
                    maxMonedas[level] = monedas;
                }
            }
            saves.SaveMonedas(this);
        }
        yield return(new WaitForSecondsRealtime(1));

        panel.enabled  = true;
        imagen.enabled = true;
        anim.SetTrigger("Muerte");
        anim2.SetTrigger("Muerte");
        GameObject boton = GameObject.Instantiate(replayButton, replayButton.transform.position, Quaternion.identity);

        boton.transform.SetParent(canvas.transform, false);
        txtPorcentaje.text = "";
        if (porcentaje >= 99.6f)
        {
            endText.text = "YOU WIN!!!!!!";
        }
        else
        {
            endText.text = "GAME OVER";
        }
        txtBest.text    = "RECORD" + "\n" + bestScore[level].ToString("F0") + "%";
        txtScore.text   = "SCORE" + "\n" + porcentaje.ToString("F0") + "%";
        monedasTxt.text = monedas + "/5 MONEDAS";
        Destroy(gameObject);
    }
Exemplo n.º 4
0
 private List <MenuItem> getFirstList()
 {
     Instance.BestTimeText.gameObject.SetActive(false);
     _inHs = false;
     Instance.LockIcon.SetActive(false);
     return(new List <MenuItem>
     {
         new MenuItem("PLAY", () =>
         {
             SwitchItems(getSecondList());
         }),
         new MenuItem("HIGH SCORES", () =>
         {
             _inHs = true;
             WebUtils.FetchScores();
             var item0 = new MenuItem(HighScores.GetString(0), () => SwitchItems(getFirstList()), p0, 0.5f, false);
             var item1 = new MenuItem(HighScores.GetString(1), () => SwitchItems(getFirstList()), p1, 0.5f, false);
             var item2 = new MenuItem(HighScores.GetString(2), () => SwitchItems(getFirstList()), p2, 0.5f, false);
             var item3 = new MenuItem(HighScores.GetString(3), () => SwitchItems(getFirstList()), p3, 0.5f, false);
             var item4 = new MenuItem(HighScores.GetString(4), () => SwitchItems(getFirstList()), p4, 0.5f, false);
             var item5 = new MenuItem(HighScores.GetString(5), () => SwitchItems(getFirstList()), p5, 0.5f, false);
             var item6 = new MenuItem(HighScores.GetString(6), () => SwitchItems(getFirstList()), p6, 0.5f, false);
             HighScores.WhenFetched[0] = () => item0.Text.text = HighScores.GetString(0);
             HighScores.WhenFetched[1] = () => item1.Text.text = HighScores.GetString(1);
             HighScores.WhenFetched[2] = () => item2.Text.text = HighScores.GetString(2);
             HighScores.WhenFetched[3] = () => item3.Text.text = HighScores.GetString(3);
             HighScores.WhenFetched[4] = () => item4.Text.text = HighScores.GetString(4);
             HighScores.WhenFetched[5] = () => item5.Text.text = HighScores.GetString(5);
             HighScores.WhenFetched[6] = () => item6.Text.text = HighScores.GetString(6);
             SwitchItems(new List <MenuItem>
             {
                 item0,
                 item1,
                 item2,
                 item3,
                 item4,
                 item5,
                 item6,
             });
         }),
         new MenuItem("RESET", () =>
         {
             PlayerData.Instance = new PlayerData();
             var pd = PlayerData.Instance;
             for (var i = 0; i < pd.Scores.Length; i++)
             {
                 PlayerPrefs.SetString("score" + i, "0");
             }
             UnitedTint.Tint = Color.white;
             Saves.Save();
             SceneManager.LoadScene(0);
             Time.timeScale = 1;
         }),
         new MenuItem("QUIT", Application.Quit)
     });
 }
Exemplo n.º 5
0
 void OnTriggerEnter(Collider other)
 {
     save = GameObject.FindGameObjectWithTag("TriggerSave").GetComponent <Saves>();//тэг относится к объекту-невидимке saves
     if (save.s != true)
     {
         if (other.GetComponent <PlayerMovement>())
         {
             save.s = true;
             save.Save(save.transform.position);
             Destroy(gameObject);
         }
     }
 }
Exemplo n.º 6
0
        public void ThreadProc()   //thread process
        {
            try {
                // start hosting node in this giant method im not going to comment
                ProcessStartInfo startInfo = new ProcessStartInfo(Saves.nodePath);
                startInfo.CreateNoWindow         = true;
                startInfo.RedirectStandardOutput = true;
                startInfo.RedirectStandardInput  = true;
                startInfo.RedirectStandardError  = true;
                startInfo.UseShellExecute        = false;

                var proc = new Process();
                proc.StartInfo           = startInfo;
                proc.EnableRaisingEvents = true;
                proc.OutputDataReceived += (sender, args) => this.Display(args.Data);
                proc.ErrorDataReceived  += (sender, args) => this.Display(args.Data);
                proc.Start();

                Saves.processID = proc.Id;
                Console.WriteLine("Process ID saved as: {0}", proc.Id);
                Saves.Save();

                char[] array = Saves.scriptPath.ToCharArray();
                string patch = ""; // adds double backslashes to fix script directory

                foreach (char letter in array)
                {
                    if (letter == '\\')
                    {
                        patch += '\\';
                    }
                    patch += letter;
                }

                var          startCommand   = String.Format("require('{0}').Start()", patch); // start the server after node has started
                StreamWriter myStreamWriter = proc.StandardInput;
                myStreamWriter.WriteLine(startCommand);
                myStreamWriter.Close();

                proc.BeginOutputReadLine();
                proc.BeginErrorReadLine();
                proc.WaitForExit();
            } catch (InvalidOperationException e) {
                Console.WriteLine("how do you even error this {0}", e);
            } catch (Win32Exception e) {
                Console.WriteLine("{0}", e);
                MessageBox.Show("Node directory is invalid. Settings > Preferences > Script settings", "Script error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
 public virtual bool TakeDmg(Unit source, int dmg = 1)
 {
     Utils.InvokeDelayed(_TakeDmgAnim, AnimationWindow / 2, this);
     HP -= dmg;
     HpMat.SetInt("_CurHp", HP);
     if (HP <= 0)
     {
         if (Level.Tutorial && MaxHP > 1 && source is Player)
         {
             Level.Tutorial = false;
             PlayerData.Instance.TutorialComplete = true;
             Level.JustFinishedTutorial           = true;
             Saves.Save();
         }
         Die();
         return(true);
     }
     return(false);
 }
Exemplo n.º 8
0
    // will hold most global updates, currently updates are somewhat scattered

    private void Update()
    {
        if ((Input.GetKeyDown(KeyCode.R)) && playerCycle < 7)
        {
            playerCycle++;
        }
        if ((Input.GetKeyDown(KeyCode.L)) && playerCycle > 1)
        {
            playerCycle--;
        }

        // saves on get key down j
        if (Input.GetKeyDown(KeyCode.J))
        {
            GameState.Current.Player1Serial = Player1Controller.player1Serial;
            GameState.Current.Player2Serial = Player2Controller.player2Serial;
            GameState.Current.Player3Serial = Player3Controller.player3Serial;
            GameState.Current.Player4Serial = Player4Controller.player4Serial;
            GameState.Current.Player5Serial = Player5Controller.player5Serial;
            GameState.Current.Player6Serial = Player6Controller.player6Serial;
            GameState.Current.Player7Serial = Player7Controller.player7Serial;
            GameState.Current.BMID          = 1;
            GameState.Current.Location      = "Not Implemented";
            GameState.Current.DateTime      = System.DateTime.Now.ToString();
            Saves.Save();
            return;
        }

        // loads on get key down k

        if (Input.GetKeyDown(KeyCode.K))
        {
            Saves.Load();
            return;
        }

        if (Input.GetKey("escape"))
        {
            boardScript.menuText.rectTransform.transform.position = new Vector3(0, 0, 0f);
            Application.Quit();
        }
    }
Exemplo n.º 9
0
    // will hold most global updates, currently updates are somewhat scattered

    private void Update()
    {
        if (inMenu == false)
        {
            if ((Input.GetKeyDown(KeyCode.R)) && playerCycle < 7)
            {
                playerCycle++;
            }
            if ((Input.GetKeyDown(KeyCode.L)) && playerCycle > 1)
            {
                playerCycle--;
            }
        }
        // saves on get key down j
        if (Input.GetKeyDown(KeyCode.J))
        {
            GameState.Current.Player1Serial = Player1Controller.player1Serial;
            GameState.Current.Player2Serial = Player2Controller.player2Serial;
            GameState.Current.Player3Serial = Player3Controller.player3Serial;
            GameState.Current.Player4Serial = Player4Controller.player4Serial;
            GameState.Current.Player5Serial = Player5Controller.player5Serial;
            GameState.Current.Player6Serial = Player6Controller.player6Serial;
            GameState.Current.Player7Serial = Player7Controller.player7Serial;
            GameState.Current.BMID          = 1;
            GameState.Current.Location      = "Not Implemented";
            GameState.Current.DateTime      = System.DateTime.Now.ToString();
            Saves.Save();
            return;
        }

        // loads on get key down k

        if (Input.GetKeyDown(KeyCode.K))
        {
            Saves.Load();
            return;
        }
    }
Exemplo n.º 10
0
 public void Load()
 {
     if (PlayerPrefs.HasKey("Amount"))
     {
         saves = JsonUtility.FromJson <Saves>(PlayerPrefs.GetString("Amount"));
     }
     else
     {
         JsonUtility.ToJson(saves = new Saves());
     }
     saves.Save();
 }
Exemplo n.º 11
0
    public void EnterGameOver()
    {
        ProgressLine.Instance.Updating = false;
        NextLevelStart = false;
        GameOverStartAction();
        var score = TimeText.text;
        var newHs = false;

        if (string.IsNullOrEmpty(PlayerData.Instance.Scores[StartedLevel]) || float.Parse(score) > float.Parse(PlayerData.Instance.Scores[StartedLevel]))
        {
            var _as = CameraScript.Instance.GetComponent <AudioSource>();
            if (float.Parse(score) >= 60f && float.Parse(PlayerData.Instance.Scores[StartedLevel]) < 60f && (StartedLevel == 1 || StartedLevel == 2 || StartedLevel == 3))
            {
                Utils.InvokeDelayed(() =>
                {
                    ScreenFlyEffect.Create("NEW LEVEL UNLOCKED");
                    _as.clip = NewBestTimeSound;
                    _as.Play();
                }, 2.2f);
            }
            Utils.InvokeDelayed(() =>
            {
                ScreenFlyEffect.Create("NEW BEST TIME");
                _as.clip = NewBestTimeSound;
                _as.Play();
            }, 0.5f);
            PlayerData.Instance.Scores[StartedLevel] = score;
            Saves.Save();
            WebUtils.SendScore(StartedLevel);
            newHs = true;
        }
        Updating = false;
        GameOver = true;

        Utils.Animate(1f, 0f, 0.5f, (v) => AudioSource.volume += v);
        float[] starts = { 0f, 13f, 43f, 66f, 90f };
        Utils.InvokeDelayed(() =>
        {
            if (newHs)
            {
                Utils.InvokeDelayed(() => NewBestTimeText.gameObject.SetActive(true), 1.5f);
            }
            AudioSource.clip = Over;
            AudioSource.time = starts[UnityEngine.Random.Range(0, starts.Length)];
            AudioSource.Play();

            Utils.Animate(0f, 0.5f, 2f, (v) => AudioSource.volume += v);
        }, 0.5f);
//		CameraScript.Instance.GetComponent<SpritePainter>().Paint(new Color(0.43f, 0f, 0.01f), GOAnimationTime / 2, true);
        Utils.Animate(Camera.main.backgroundColor, Color.black, GOAnimationTime / 2, (v) => Camera.main.backgroundColor += v);
        Utils.Animate(UnitedTint.Tint, Color.white, GOAnimationTime / 2, (v) => UnitedTint.Tint = v, null, true);
        Pattern.Instance.Reset();
        Utils.InvokeDelayed(() => KillEverything(), GOAnimationTime / 2);
        var gm   = GridMarks.Instance;
        var rtut = gm.LeftText.GetComponent <UnitedTint>();
        var qtut = gm.RightText.GetComponent <UnitedTint>();
        var ct   = rtut.Color;

        ct = new Color(ct.r, ct.g, ct.b, 0);
        var    tt          = TimeText.color;
        Action killerEvent = () => { };
        Action a           = () => Utils.InvokeDelayed(() =>
        {
            JustFinishedTutorial = false;
            gm.Set("< RESTART", "QUIT >", -3, 1, -3, 1, () =>
            {
                if (!GameOver)
                {
                    return;
                }
                ExitGameover();
                CurrentLevel = StartedLevel;
                Utils.InvokeDelayed(OnEnable, GOAnimationTime / 4);
            }, () =>
            {
                CameraScript.Instance.SwitchScene(() =>
                {
                    ExitGameover();
                    gameObject.SetActive(false);
                    Menu.Instance.gameObject.SetActive(true);
                    Menu.Instance.RefreshItems(true);
                });
            });
            gm.DisplayBorders(false);

            Utils.Animate(0f, 1f, GOAnimationTime / 4, (v) =>
            {
                CameraScript.Instance.InvProgress += v;
                ct.a                 += v;
                rtut.Color            = ct;
                qtut.Color            = ct;
                tt.r                  = 1 - ct.a;
                tt.g                  = 1 - ct.a;
                tt.b                  = 1 - ct.a;
                TimeText.color        = tt;
                BT.color              = tt;
                BestTimeText.color    = tt;
                NewBestTimeText.color = tt;
            });
        }, GOAnimationTime * 0.75f);

        if (JustFinishedTutorial && Killer != null)
        {
            gm.Set("", "", -3, 1, -3, 1, () => { }, () => { }, true, true);
            killerEvent = a;
            gm.DisplayBorders(true);
        }
        else
        {
            a();
        }
        Utils.InvokeDelayed(() =>
        {
            RespawnGOUnits();
            RespawnKiller(killerEvent);
            GameOverAction();
        }, GOAnimationTime + (newHs ? 1.8f : 0f));
    }
Exemplo n.º 12
0
 public void SerializeModuleList(OnlineModuleList list)
 {
     Saves.Save("custom", "OnlineModuleList", list);
 }