Exemple #1
0
        // Use this for initialization
        void Start()
        {
            //Canvas Initialization
            gObj      = new GameObject();
            gObj.name = "SelectionCanvas";
            Canvas canvas = gObj.AddComponent <Canvas> ();

            canvas.renderMode = RenderMode.ScreenSpaceOverlay;
            CanvasScaler cs = gObj.AddComponent <CanvasScaler> ();

            cs.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            GraphicRaycaster gRay = gObj.AddComponent <GraphicRaycaster> ();

            //Button stored by position
            spot1 = 0;
            spot2 = 1;

            //Initialize Buttons
            initButtons();

            mainObject = GameObject.Find("MainObject");

            cManager = mainObject.GetComponent <ConnectionManager>();

            //		NetworkRequestTable.init();
            //		NetworkResponseTable.init();

            mainObject.GetComponent <MessageQueue>().AddCallback(Constants.SMSG_RRSTARTGAME, ResponseRRStartGame);
            mainObject.GetComponent <MessageQueue>().AddCallback(Constants.SMSG_RRGETMAP, ResponseRRGetMap);

            RequestRRGetMap reqmap = new RequestRRGetMap();

            reqmap.Send();
            cManager.Send(reqmap);
        }
        // Use this for initialization
        void Start()
        {
            //Canvas Initialization
            gObj = new GameObject ();
            gObj.name = "SelectionCanvas";
            Canvas canvas = gObj.AddComponent<Canvas> ();
            canvas.renderMode = RenderMode.ScreenSpaceOverlay;
            CanvasScaler cs = gObj.AddComponent<CanvasScaler> ();
            cs.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            GraphicRaycaster gRay = gObj.AddComponent<GraphicRaycaster> ();

            //Button stored by position
            spot1 = 0;
            spot2 = 1;

            //Initialize Buttons
            initButtons ();

            mainObject = GameObject.Find ("MainObject");

            cManager = RRConnectionManager.getInstance ();

            //		NetworkRequestTable.init();
            //		NetworkResponseTable.init();

            RRMessageQueue.getInstance ().AddCallback (Constants.SMSG_RRSTARTGAME, ResponseRRStartGame);
            RRMessageQueue.getInstance ().AddCallback (Constants.SMSG_RRGETMAP, ResponseRRGetMap);

            RequestRRGetMap reqmap = new RequestRRGetMap ();
            reqmap.Send ();
            cManager.Send (reqmap);
        }