Beispiel #1
0
    void Start()
    {
        FB.Init(SetInit, OnHideUnity);
        //lets show the cursor and unlock it (incase it was).
        Screen.lockCursor = false;
        Screen.showCursor = true;
        Time.timeScale    = 1;

        m_on = true;
        Debug.Log(Application.persistentDataPath + "/PlayerPrefs.txt");
        //showHighScore = PreviewLabs.PlayerPrefs.GetInt("Highscore");
        //orignalWidth = Screen.width;
        //orignalHeight = Screen.height;
        // Saving Score if user goes into main menu while playing game.
        Debug.Log("check from main menu to asking to save score " + EventTalk.EventTrigger.askToSaveScore);
        if (EventTalk.EventTrigger.askToSaveScore == true)
        {
            //  publicService.SubmitScoreToLeaderBoards ();
            LaserMove.Save();
        }
    }
Beispiel #2
0
    void OnGUI()
    {
        GUI.skin = skins;
        //Scaling GUI MATRIX FOR ALL RESOLUTION
        scale.x = Screen.width / 320.0f;
        scale.z = Screen.height / 480.0f;
        scale.y = 1f;
        var svMat = GUI.matrix;

        Debug.Log(Screen.width.ToString());
        Debug.Log(Screen.height.ToString());
        Debug.Log(scale.x.ToString());
        Debug.Log(scale.z.ToString());
        GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale);

        GUI.Box(new Rect(0, Screen.height - 70, Screen.width, 70), "", noGUIStyle);
        GUI.Label(new Rect(5, Screen.height - 60, 400, 100), " Score  " + score.ToString());
        GUI.Label(new Rect(5, Screen.height - 40, 400, 100), " HighScore   " + high);
        GUI.Box(new Rect(170, Screen.height - 70, Screen.width, 70), "", noGUIStyle);
        GUI.Label(new Rect(180, Screen.height - 60, 100, 100), " Lives  x" + " " + PlayerLive);
        //GUI.DrawTexture(new Rect(270,Screen.height - 60,50,25),lives[PlayerLive]);


        if (finishedLevel)
        {
            if (scrChecker >= 1)
            {
                finishedLevel = false;
            }
            else
            {
                finishedLevel  = false;
                Time.timeScale = 0;
                //BridgeJTOC.Bridge.setScore(score);
                //BridgeJTOC.Bridge.setKill(killCounter);
                Instantiate(HighScore, transform.position, transform.rotation);
                Destroy(pauseButton);
                scrChecker++;
                LaserMove.Save();
            }
        }
        if (gameOver == true)
        {
            LaserMove.Save();
            AutoFade.LoadLevel("GameOver", 1, 1, Color.red);
            fbFeed();
        }
        if (Application.platform == RuntimePlatform.Android)
        {
            if (Input.GetKeyUp(KeyCode.Escape))
            {
                publicService.SubmitScoreToLeaderBoards();
                fbCheck();
                // FB.Logout ();
                LaserMove.Save();


                Instantiate(AlertBoxPrefeb, transform.position, transform.rotation);
                //return;
            }
        }
        GUI.matrix = svMat;
    }