void ReleaseDesignerOutlets()
        {
            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (DeleteBtn != null)
            {
                DeleteBtn.Dispose();
                DeleteBtn = null;
            }

            if (DoneBtn != null)
            {
                DoneBtn.Dispose();
                DoneBtn = null;
            }

            if (TextView != null)
            {
                TextView.Dispose();
                TextView = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (CancelBtn != null)
            {
                CancelBtn.Dispose();
                CancelBtn = null;
            }

            if (DoneBtn != null)
            {
                DoneBtn.Dispose();
                DoneBtn = null;
            }

            if (PopOverTableView != null)
            {
                PopOverTableView.Dispose();
                PopOverTableView = null;
            }

            if (subtitleText != null)
            {
                subtitleText.Dispose();
                subtitleText = null;
            }

            if (titleText != null)
            {
                titleText.Dispose();
                titleText = null;
            }
        }
Ejemplo n.º 3
0
        public void test()
        {
            int count = 1;

            try
            {
                while (count < 100)
                {
                    IWebElement row = PropertiesCollection.driver.FindElement(By.XPath("//*[@id=\"rowCountTable\"]/tbody/tr[" + count + "]"));
                    count++;
                }
            }
            catch (NoSuchElementException e)
            {
                count = count - 1;
            }
            SetMethods.EnterText(rowCount, "" + count);
            DoneBtn.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
Ejemplo n.º 4
0
    void Awake()
    {
        Application.runInBackground = true;      //防止后台掉线
        CustomTypes.Register();
        _client       = new PhotonClient();
        _client.AppId = "49395063-2a0e-4e1f-a35d-3d4600790bc2";      //Turnbased 的 ID
        //_client.AppId="bc31b098-957d-4231-9ad5-b75adc3c6fb7";// RealTime 的ID
        bool connectInProcess = _client.ConnectToRegionMaster("asia");

        _go_GuessBricks = GameObject.Find("GuessBricks").transform;
        MyDock          = GameObject.Find("DockD").transform;
        PickPop         = GameObject.Find("PickPop").transform;
        _planet         = GameObject.Find("Planet");
        _table          = _planet.transform.GetChild(0).gameObject;
        _unOccupied     = _table.transform.GetChild(5).gameObject;
        //--------------找到UI元素------------
        Notify      = GetComponent <Notification>();
        Panel       = GameObject.Find("Panel").transform;
        StartBtn    = GameObject.Find("Start").transform;
        _canvas     = GameObject.Find("Canvas");
        _winBanner  = GameObject.Find("Win").transform;
        _panel      = GameObject.Find("Panel");
        _readyPanel = GameObject.Find("ReadyPanel");
        _overPanel  = GameObject.Find("OverPanel");
        DoneBtn     = GameObject.Find("AdjustDone").transform;
        CancelBtn   = GameObject.Find("Cancel").transform;
        ContinueBtn = GameObject.Find("ContinueGuess").transform;
        _loading    = GameObject.Find("Loading").transform;
        //-----------------------



        if (GameControl._instance == null)
        {
            GameControl._instance = this;
        }
        DontDestroyOnLoad(gameObject);

        #region 注册UI事件
        GameObject.Find("Create").GetComponent <Button>().onClick.AddListener(
            () => {
            if (_roomName != "")
            {
                _client.OpCreateRoom(_roomName, new RoomOptions()
                {
                    MaxPlayers = _playerNum
                }, TypedLobby.Default);
            }
        });
        GameObject.Find("Join").GetComponent <Button>().onClick.AddListener(
            () => {
            if (_roomName != "")
            {
                _client.OpJoinRoom(_roomName);
            }
        });
        GameObject.Find("PlayerNum").GetComponent <Dropdown>().onValueChanged
        .AddListener(x => {
            _playerNum = (byte)(x + 2);
        });
        GameObject.Find("RoomName").GetComponent <InputField>().onValueChanged
        .AddListener(x => {
            _roomName = x;
        });
        GameObject.Find("Leave").GetComponent <Button>().onClick.AddListener(
            () => {
            //销毁玩家头像
            foreach (var icon in _playerIcons)
            {
                Destroy(icon.gameObject);
            }
            _playerIcons.Clear();

            //通知其他人  我离开了
            _client.OpRaiseEvent(MyEventCode.OneLeave, _myID, true, RaiseEventOptions.Default);

            _client.OpLeaveRoom(false);
            _overPanel.SetActive(false);
            _panel.SetActive(true);
        });
        GameObject.Find("Again").GetComponent <Button>().onClick.AddListener(
            () => {
            //currentID 为自己
            CurrentID = _myID;
            //重新设置玩家头像的parent
            for (int i = 0; i < _playerNum; i++)
            {
                var icon = _playerIcons[i];
                icon.SetParent(_readyPanel.transform);
            }
            //自己的头像放到readypos  并且通知别人
            //playerIcons readyPos的顺序和id一样 注意ID从1 开始
            var myIcon = _playerIcons[_myID - 1];
            AnimElement.Prepare()
            .InitUGUI(myIcon.localPosition,
                      readyPos[_myID - 1],
                      myIcon,
                      0,
                      40)
            .AddScaleAnimation(myIcon.localScale, Vector3.one * 0.6f)
            .Play();
            _client.OpRaiseEvent(MyEventCode.OnePlayAgain, _myID, true, RaiseEventOptions.Default);


            //载入等待面板
            _overPanel.SetActive(false);
            _readyPanel.SetActive(true);

            EnterRoom(_playerNum);
        });
        //房主开始游戏
        GameObject.Find("Start").GetComponent <Button>().onClick.AddListener(
            () => {
            //洗牌
            ShuffleDeck();
            //-----------------------------
            //把所有的牌发送给其他玩家
            //-----------------------
            _client.OpRaiseEvent(MyEventCode.SyncAllBricks, indexMap, true
                                 , RaiseEventOptions.Default);
            //放置牌到桌子上
            PlaceAllBricksOnTable(indexMap);
            StartGame();
        });
        // 完成 按钮的点击逻辑
        DoneBtn.GetComponent <Button>().onClick.AddListener(() => {
            // 玩家确认完成Adjust过程中的joker放置后 点击
            if (GameState.Instance.CurrentState == GameState.State.Adjust)
            {
                //通知其他玩家在逻辑层更新我的Joker位置
                int msgType = 0;
                int[] msg   = new int[4];
                msg[0]      = _myID;
                if (_decks[_myDeckIndex].Contains(_jokerWhite))
                {
                    msgType = -1;
                    msg[2]  = _decks[_myDeckIndex].IndexOf(_jokerWhite);
                }
                if (_decks[_myDeckIndex].Contains(_jokerBlack))
                {
                    msgType = -msgType;
                    msg[3]  = _decks[_myDeckIndex].IndexOf(_jokerBlack);
                }
                msg[1] = msgType;
                _client.OpRaiseEvent(MyEventCode.SyncJoker, msg, true, RaiseEventOptions.Default);

                //
                LocalReadyToGo();
                //隐藏所有arrows for joker
                _jokerBlack.GetComponent <Brick>().DestroyArrows();
                _jokerWhite.GetComponent <Brick>().DestroyArrows();
            }
            //  每一round中抽到joker的玩家确认完成joker的放置后点击
            else if (GameState.Instance.CurrentState == GameState.State.PlacingJoker)
            {
                //进入Guess状态
                GameState.Instance.CurrentState = GameState.State.GuessABrick;
                //视觉提示 让我猜牌
                Notify.autoNtf("请猜牌", Vector2.zero, new Vector2(1, 1), 1);

                //隐藏所有arrows for joker
                _jokerBlack.GetComponent <Brick>().DestroyArrows();
                _jokerWhite.GetComponent <Brick>().DestroyArrows();
            }
            else if (GameState.Instance.CurrentState == GameState.State.GuessingABrick)
            {
                //不猜了   轮到下一个玩家
                ToNextOne();
                //隐藏按钮
                ContinueBtn.gameObject.SetActive(false);
                DoneBtn.gameObject.SetActive(false);
                //切换状态
                GameState.Instance.CurrentState = GameState.State.WaitForOthers;
            }

            DoneBtn.gameObject.SetActive(false);
        });
        //取消猜牌按钮的点击逻辑
        CancelBtn.GetComponent <Button>().onClick.AddListener(() => {
            CancelBtn.gameObject.SetActive(false);
            //隐藏所有PossibleBrick
            HidePossibleBricks();
            //状态回到GuessABrick
            GameState.Instance.CurrentState = GameState.State.GuessABrick;
        });
        //继续猜
        ContinueBtn.GetComponent <Button>().onClick.AddListener(() => {
            GameState.Instance.CurrentState = GameState.State.GuessABrick;
            ContinueBtn.gameObject.SetActive(false);
            DoneBtn.gameObject.SetActive(false);
        });
        #endregion

        //----初始化UI状态----------
        _readyPanel.SetActive(false);
        DoneBtn.gameObject.SetActive(false);
        CancelBtn.gameObject.SetActive(false);
        ContinueBtn.gameObject.SetActive(false);
        Panel.gameObject.SetActive(false);
        StartBtn.gameObject.SetActive(false);
        _overPanel.SetActive(false);

        //--------------------------------------
    }