Esempio n. 1
0
 /// <summary>
 /// Pauses the game, while switiching the displayed canvas
 /// </summary>
 /// <param name="canvasToShow"></param>
 public void Pause(Canvases canvasToShow)
 {
     Time.timeScale   = 0.0f;
     GlobalPauseState = PauseState.Paused;
     //CursorManager.ChangeCursorState(CursorLockMode.Confined);
     MakeActiveCanvas(canvasToShow);
 }
            public uint AddCanvas(WzCanvasProperty node)
            {
                uint ret = (uint)Canvases.Count;

                Canvases.Add(node);
                return(ret);
            }
Esempio n. 3
0
    public void GoToCanvas(string name)
    {
        //var camera = Camera;
        var canvas = Canvases.Where(c => c.name == name).FirstOrDefault();

        if (canvas != null)
        {
            GoToCanvas(canvas);
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Used to move activation of menu to after initialized of menu components and types
    /// is complete
    /// </summary>
    private void Init()
    {
        GameObject[] goArray = GameObject.FindGameObjectsWithTag(CANVAS_TAG);
        CanvasDict = new Dictionary <Canvases, Canvas>();

        foreach (GameObject canvasGO in goArray)
        {
            Canvases typeToAdd   = canvasGO.GetComponent <CanvasAttachment>().CanvasType;
            Canvas   canvasToAdd = canvasGO.GetComponent <Canvas>();

            CanvasDict.Add(typeToAdd, canvasToAdd);
        }
        MakeActiveCanvas(Canvases.BreakoutGame);
    }
Esempio n. 5
0
 /// <summary>
 /// Makes the passed in canvas active and setts all others to inactive
 /// </summary>
 /// <param name="canvasToDisplay"></param>
 public void MakeActiveCanvas(Canvases canvasToDisplay)
 {
     foreach (Canvas canvas in CanvasDict.Values)
     {
         if (canvasToDisplay == canvas.gameObject.GetComponent <CanvasAttachment>().CanvasType)
         {
             canvas.enabled = true;
         }
         else
         {
             canvas.enabled = false;
         }
     }
 }
Esempio n. 6
0
    // Use this for initialization
    void Awake()
    {
        if (singleton == null)
        {
            singleton = this;
        }
        else if (singleton != this)
        {
            Destroy(gameObject);
            return;
        }

        canvases = FindObjectOfType <Canvases>();

        BeginAuthorize();
    }
Esempio n. 7
0
    /// <summary>
    /// Check time span from previous login
    /// </summary>
    public IEnumerator CurrentDateTime()
    {
        canvases = GameObject.FindObjectOfType <Canvases>();

        if ((Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) || (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork))
        {
            using (WWW www = new WWW("http://www.microsoft.com"))
            {
                yield return(www);

                try
                {
                    string s = GameManager.singleton.playerData.lastSession.ToString();
                }
                catch
                {
                    GameManager.singleton.playerData.lastSession = "";
                    GameManager.singleton.SavePlayerData();
                }

                if (GameManager.singleton.playerData.lastSession.Length == 0)
                {
                    GameManager.singleton.playerData.lastSession = DateTime.ParseExact(www.responseHeaders["date"], "ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal).ToString();
                    GameManager.singleton.SavePlayerData();

                    if (canvases.mainUI != null)
                    {
                        canvases.mainUI.ShowPrizeBtn();
                    }
                }
                else
                {
                    currentDateTime = DateTime.ParseExact(www.responseHeaders["date"], "ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal);
                    timeSpan        = currentDateTime - DateTime.Parse(GameManager.singleton.playerData.lastSession);

                    if (timeSpan.TotalHours >= 5)
                    {
                        canvases.mainUI.ShowPrizeBtn();
                    }
                }
            }
        }

        yield return(null);
    }
Esempio n. 8
0
        /// <summary>
        /// Processes the input
        /// </summary>
        /// <param name="input">The input.</param>
        protected void ProcessInput(Char input)
        {
            switch (input)
            {
            case '1':
                Canvas canvas = CreateNewCanvas();

                this.Canvases.Clear();

                if (canvas != null)
                {
                    this.Canvases.Add(canvas);
                    OutputWriter.SendToOutput("Enter 2 to start drawing shapes", true);
                }
                else
                {
                    OutputWriter.SendToOutput("Please select option 1 and then start creating shapes", true);
                }

                break;

            case '2':
                if (this.Canvases.Count > 0)
                {
                    CanvasHandler canvasHandler = new CanvasHandler(Canvases.First(), InputCommandReader, InputCommandValidator, OutputWriter);
                    canvasHandler.DisplayMenu();
                }
                else
                {
                    OutputWriter.SendToOutput("There is no canvas created, please select option 1 and then start creating shapes", true);
                }
                break;

            case '3':
                OutputWriter.SendToOutput("Quitting the application now", true);
                AppExit();
                break;

            default:
                OutputWriter.SendToOutput("Invalid input, please select the options from the menu below", true);
                break;
            }
        }
Esempio n. 9
0
    private void SaveReadPlayerData(SavedGameRequestStatus status, byte[] data)
    {
        if (status == SavedGameRequestStatus.Success)
        {
            GameManager.singleton.playerData = (PlayerData)ByteArrayToObject(data);

            if (GameManager.singleton.playerData.cars[0] == 0)
            {
                GameManager.singleton.playerData.cars[0]       = 1;
                GameManager.singleton.playerData.currentCar    = 0;
                GameManager.singleton.playerData.currentGarage = 0;

                if (canvases == null)
                {
                    canvases = GameObject.FindObjectOfType <Canvases>();
                }

                if (canvases.mainUI != null)
                {
                    canvases.mainUI.ShowPlayerData();
                }

                CloudSaves(true, true, GameManager.singleton.playerData);
            }

            if (canvases == null)
            {
                canvases = GameObject.FindObjectOfType <Canvases>();
            }
            if (canvases.mainUI != null)
            {
                canvases.mainUI.ShowPlayerData();
            }

            canvases.preroll.ActivateLoadingScene(1);
        }
        else
        {
            Debug.Log("Not succeed! Save Read Player Data!");
        }
    }
Esempio n. 10
0
 public void FirstInitialize(Canvases canvases)
 {
     _canvases = canvases;
 }