Beispiel #1
0
        public override int GetHashCode()
        {
            int hashCode = 2062186786;

            hashCode = (hashCode * -1521134295) + EqualityComparer <ITeamInMatch> .Default.GetHashCode(Team);

            hashCode = (hashCode * -1521134295) + SetCount.GetHashCode();
            hashCode = (hashCode * -1521134295) + GameCount.GetHashCode();
            hashCode = (hashCode * -1521134295) + Points.GetHashCode();
            return(hashCode);
        }
    void Awake()
    {
        openPanelSound = Resources.Load <AudioClip>("Audios/UI/OpenPanel");

        handControl = transform.Find("OperatePanel/HandControlBack/HandControl");
        op          = transform.Find("OperatePanel").GetComponent <OperatePanel> ();
        gc          = GameObject.Find("ScriptsManager").GetComponent <GameCount> ();

        sellButton = new Button[6];
        for (int i = 0; i < 6; i++)
        {
            int l = i + 1;
            sellButton[i] = GameObject.Find("UI/DataPanel/DetailPanel/Item/Slot" + l + "/Button").GetComponent <Button>();
        }
        HideAllSellButton();

        gold = transform.Find("DataPanel/Gold/Text").GetComponent <Text> ();
    }
    public void SaveGameCountWithSerializer()
    {
        BinaryFormatter bf = new BinaryFormatter();

        print("Save location:" + Application.persistentDataPath + " - in folder '/gameCount.dat'");
        FileStream file = File.Create(Application.persistentDataPath + "/gameCount.dat");

        GameCount gameCountData = new GameCount();

        gameCountData.gameCount = gameCount + 1;

        print("Here's new gameCount at end of game in GameController.cs - SGCWS (): " + gameCountData.gameCount);

        mazelTov = gameCount + 1;


        bf.Serialize(file, gameCountData);
        file.Close();
    }
    public void LoadGameCountWithSerializer()
    {
        if (File.Exists(Application.persistentDataPath + "/gameCount.dat"))
        {
            FileStream      file = File.Open(Application.persistentDataPath + "/gameCount.dat", FileMode.Open);
            BinaryFormatter bf   = new BinaryFormatter();
            print(Application.persistentDataPath);
            GameCount gameCountData = (GameCount)bf.Deserialize(file);
            file.Close();

            gameCount = gameCountData.gameCount;
            print("if - Previous gameCount = " + gameCount);
        }
        else
        {
            gameCount = 0;
            print("(GameController.cs/LGCWS()/else - No gameCount serialized!");
            print("GameController.cs/LGCWS()/else - setting gameCount to: " + gameCount);
        }

        //print("gameCount at start of game is = " + gameCount);
    }
Beispiel #5
0
    /// <summary>
    /// 遷移開始
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    IEnumerator SceneActiveChange(SceneState name)
    {
        LaserPointer laserObj;          // レーザポインターを消したりつけたりするために使用

        // 2重に通らないようにフラグを立てておく
        changeNowFlg = true;

        // フェードアウトするまで先へは進めない
        yield return(StartCoroutine(fade.FadeOut()));

        // チュートリアルまたはゲームメインから変わるときにカメラの座標を引き継ぐためのスクリプト
        if (sceneStateOld == SceneState.Tutorial || sceneStateOld == SceneState.GameMain)
        {
            Transform otherCameraTransform;
            // 超危険な取り方をしております
            // エミュ上
            if (CameraHeadObj.activeSelf)
            {
                otherCameraTransform             = GameObject.Find("Camera (head)").transform;
                CameraHeadObj.transform.position = otherCameraTransform.position;
                CameraHeadObj.transform.rotation = otherCameraTransform.rotation;
            }

            // VR上
            else if (CameraEyeObj.activeSelf)
            {
                otherCameraTransform            = GameObject.Find("Camera (eye)").transform;
                CameraEyeObj.transform.position = otherCameraTransform.position;
                CameraEyeObj.transform.rotation = otherCameraTransform.rotation;
            }
        }

        // sceneに入っている無駄なものをすべて削除する
        foreach (GameObject g in GameObject.FindObjectsOfType <GameObject>())
        {
            if (g.transform.root.gameObject.tag != "SceneManager")
            {
                Destroy(g.transform.root.gameObject);
            }
        }

        // 一応残しておく

        /*// もし右手にレーザーがついてたら削除する
         * laserObj = GameObject.Find("RightController").GetComponent<LaserPointer>();
         * if (laserObj) {
         *      laserObj.DestroyPrefab();
         * }
         *
         * // もし左手にレーザーがついてたら削除する
         * laserObj = GameObject.Find("LeftContorller").GetComponent<LaserPointer>();
         * if (laserObj) {
         *      laserObj.DestroyPrefab();
         * }
         */
        CameraChange(true);

        // 不要になったシーンを削除する
        for (int sequence = 0; sequence < SceneState.MaxScene.GetHashCode(); sequence++)
        {
            if (sceneFlg[sequence] == true)
            {
                SceneManager.UnloadSceneAsync(sceneName[sequence]);
                sceneFlg[sequence] = false;
            }
        }

        if (name != SceneState.Result)
        {
            GameCount.CountReset();
        }

        yield return(new WaitForEndOfFrame());

        // タイトル、リザルト、ステージセレクトへ遷移する場合はカメラを切り替えてレーザーの作成を行います
        if (name == SceneState.Title || name == SceneState.Result || name == SceneState.StageSelect)
        {
            // アクティブシーンの切り替え
            SceneManager.SetActiveScene(SceneManager.GetSceneByName("SceneManager"));

            // 一応残しておく

            /*// もし左手にレーザーがついてたら作成する
             * laserObj = GameObject.Find("RightController").GetComponent<LaserPointer>();
             * if (laserObj) {
             *      laserObj.CreatPrefab();
             * }
             *
             * // もし左手にレーザーがついてたら作成する
             * laserObj = GameObject.Find("LeftContorller").GetComponent<LaserPointer>();
             * if (laserObj) {
             *      laserObj.CreatPrefab();
             * }*/
        }

        // シーンの追加
        AsyncOperation async = SceneManager.LoadSceneAsync(sceneName[name.GetHashCode()], LoadSceneMode.Additive);

        while (true)
        {
            if (async.isDone == true)
            {
                break;
            }
            yield return(null);
        }

        effectCanvasObj.worldCamera = GameObject.Find("Camera (eye)").GetComponent <Camera>();

        // アクティブシーンの切り替え
        SceneManager.SetActiveScene(SceneManager.GetSceneByName(sceneName[name.GetHashCode()]));

        // フェードインするまで先へ進めないよ
        yield return(StartCoroutine(fade.FadeIn()));

        sceneFlg[name.GetHashCode()] = true;

        changeNowFlg  = false;
        sceneStateOld = name;
    }
        protected override void OnPaint(PaintEventArgs pe)
        {
            using (var g = pe.Graphics)
            {
                var gameCountWidth     = (int)(this.Width * _gameCountFactor);
                var gameCountRectF     = new RectangleF(0, 0, gameCountWidth, this.Height);
                var gameCountTextSize  = g.MeasureString(GameCount.ToString("0,0"), this.Font);
                var gameCountTextRectF = new RectangleF(gameCountRectF.Width - gameCountTextSize.Width, 0, gameCountTextSize.Width, this.Height);

                var whiteRectF     = new RectangleF(gameCountWidth, 0, (this.Width - gameCountWidth) * this.WhitePercent / 100, this.Height);
                var whiteTextSize  = g.MeasureString($"{this.WhitePercent}%", this.Font);
                var whiteTextRectF = new RectangleF(whiteRectF.X + (whiteRectF.Width - whiteTextSize.Width) / 2, 0, whiteTextSize.Width, this.Height);

                var nullRectF     = new RectangleF(gameCountWidth + whiteRectF.Width, 0, (this.Width - gameCountWidth) * this.NullPercent / 100, this.Height);
                var nullTextSize  = g.MeasureString($"{this.NullPercent}%", this.Font);
                var nullTextRectF = new RectangleF(nullRectF.X + (nullRectF.Width - nullTextSize.Width) / 2, 0, nullTextSize.Width, this.Height);

                var blackRectF     = new RectangleF(gameCountWidth + whiteRectF.Width + nullRectF.Width, 0, this.Width - (gameCountRectF.Width + whiteRectF.Width + nullRectF.Width), this.Height);
                var blackTextSize  = g.MeasureString($"{this.BlackPercent}%", this.Font);
                var blackTextRectF = new RectangleF(blackRectF.X + (blackRectF.Width - blackTextSize.Width) / 2, 0, blackTextSize.Width, this.Height);

                //  Draw Game Count
                g.FillRectangle(Brushes.Black, gameCountRectF);
                if (GameCount == 0)
                {
                    g.DrawString("??", this.Font, Brushes.Gainsboro, gameCountTextRectF);
                }
                else
                {
                    if (gameCountTextSize.Width < gameCountRectF.Width)
                    {
                        g.DrawString(GameCount.ToString("0,0"), this.Font, Brushes.Gainsboro, gameCountTextRectF);
                    }
                }

                //  Draw White percentage
                g.FillRectangle(_whiteBrush, whiteRectF);
                if (GameCount == 0)
                {
                    g.DrawString("??", this.Font, Brushes.Black, whiteTextRectF);
                }
                else
                {
                    if (whiteTextSize.Width < whiteRectF.Width)
                    {
                        g.DrawString($"{this.WhitePercent}%", this.Font, Brushes.Black, whiteTextRectF);
                    }
                }

                //  Draw null percentage
                g.FillRectangle(_nullBrush, nullRectF);
                if (GameCount == 0)
                {
                    g.DrawString("??", this.Font, Brushes.Gainsboro, nullTextRectF);
                }
                else
                {
                    if (nullTextSize.Width < nullRectF.Width)
                    {
                        g.DrawString($"{this.NullPercent}%", this.Font, Brushes.Gainsboro, nullTextRectF);
                    }
                }

                //  Draw Blacks percentage
                g.FillRectangle(_blackBrush, blackRectF);
                if (GameCount == 0)
                {
                    g.DrawString("??", this.Font, Brushes.Gainsboro, blackTextRectF);
                }
                else
                {
                    if (blackTextSize.Width < blackRectF.Width)
                    {
                        g.DrawString($"{this.BlackPercent}%", this.Font, Brushes.Gainsboro, blackTextRectF);
                    }
                }

                g.Flush();
            }
        }
        /// <summary>
        /// Transforms the game record.
        /// </summary>
        /// <returns>False is this game record must be skipped (e.g. by RemoveNoShowdown). The game record may be nevertheless partially transformed.</returns>
        public bool Transform(GameRecord gameRecord)
        {
            RenamePlayers(gameRecord);

            // Now we know the hero
            int heroPos = GetHeroPos(gameRecord);

            if (RemoveNoHeroMoves)
            {
                bool heroMoved = false;
                foreach (PokerAction pa in gameRecord.Actions)
                {
                    if (pa.IsPlayerAction(heroPos))
                    {
                        heroMoved = true;
                        break;
                    }
                }
                if (!heroMoved)
                {
                    return(false);
                }
            }

            GameState gs = new GameState(gameRecord, null);

            if (gs.IsGameOver)
            {
                if (RemoveNoShowdown && !gs.IsShowdownRequired)
                {
                    return(false);
                }
            }

            if (HideOpponentCards)
            {
                DoHideOpponentCards(gameRecord, heroPos);
            }
            if (NormalizeCards)
            {
                DoNormalizeCards(gameRecord);
            }
            if (ResetResults)
            {
                foreach (GameRecord.Player p in gameRecord.Players)
                {
                    p.Result = 0;
                }
            }
            if (ResetStacks)
            {
                foreach (GameRecord.Player p in gameRecord.Players)
                {
                    p.Stack = 0;
                }
            }
            if (NormalizeStakes >= 0)
            {
                double factor = NormalizeStakes;
                if (NormalizeStakes == 0 && gameRecord.Players.Count >= 2)
                {
                    factor = gameRecord.Players[1].Blind;
                }
                gameRecord.NormalizeStakes(factor);
            }
            // Do renaming at the end in case we removed some games.
            if (RenumerateGames)
            {
                gameRecord.Id = GameCount.ToString();
                GameCount++;
            }

            if (FinalizeGames)
            {
                gameRecord.IsGameOver = true;
            }
            return(true);
        }
Beispiel #8
0
    // Use this for initialization
    void Start()
    {
        _instance = this;

        uiManager = GameObject.Find("UI").GetComponent <UIManager> ();                               //1V1 or 3V3
        if (uiManager.mapSelect == MapSelect.oneVSone)
        {
            camp           = Scence1v1_Intialize.Instance.playerCamp;
            roleMains_Red  = new Role_Main[1];
            roleMains_Blue = new Role_Main[1];
            roles_Red      = new Record_Role[1];
            roles_Blue     = new Record_Role[1];
            if (camp == Role_Camp.Red)
            {
                roleMains_Red [0]  = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> ();
                roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> ();
            }
            if (camp == Role_Camp.Blue)
            {
                roleMains_Red [0]  = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> ();
                roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> ();
            }
        }
        if (uiManager.mapSelect == MapSelect.threeVSthree)
        {
            camp           = Scence3v3_Intialize.Instance.playerCamp;
            roleMains_Red  = new Role_Main[3];
            roleMains_Blue = new Role_Main[3];
            roles_Red      = new Record_Role[3];
            roles_Blue     = new Record_Role[3];
            if (camp == Role_Camp.Red)
            {
                for (int i = 0; i < Scence3v3_Intialize.Instance.role_Players.Length; i++)
                {
                    roleMains_Red [i]  = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> ();
                    roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> ();
                }
            }
            if (camp == Role_Camp.Blue)
            {
                for (int i = 0; i < Scence3v3_Intialize.Instance.role_AIs.Length; i++)
                {
                    roleMains_Red [i]  = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> ();
                    roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> ();
                }
            }
        }



        towerBlue = GameObject.Find("shuiJingBlue").GetComponent <TowerBaseInfo>();
        towerRed  = GameObject.Find("shuiJingRed").GetComponent <TowerBaseInfo> ();
        CanOver   = false;
        cam       = Camera.main.transform;
        redPos    = GameObject.Find("shuiJingRed").transform;
        bluePos   = GameObject.Find("shuiJingBlue").transform;

        obj_win    = GameObject.Find("UI/gameOverShow/win");
        obj_lose   = GameObject.Find("UI/gameOverShow/lose");
        obj_button = GameObject.Find("UI/gameOverShow/gameover");
        obj_win.SetActive(false);
        obj_lose.SetActive(false);
        obj_button.SetActive(false);
    }