Example #1
0
    private void OnEntry()
    {
        Debug.Log("OnEntry");

        // ログ出力情報をクリアする。
        DisplayLogClear();

        // 入力エラーは処理を中断
        if (InputCheck() == false)
        {
            return;
        }

        // 入力されたPlayerNameの値を一旦退避する
        GlobalGameManager._instance.PlayerName = txtPlayerName.text;

        // 入力オブジェクトの無効化
        PlayerName.GetComponent <InputField>().interactable = false;
        Entry.interactable = false;

        //
        this.titleMode = TitleMode.Entry_Wait;

        // Photonとの接続(初期設定)
        StartCoroutine(GlobalGameManager._instance.photonManager.InitPhotonConnect());

        //
        DisplayLog(">ネットワークへの接続開始...");
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //
        this.titleMode = TitleMode.Input_Wait;

        // 画面コントローラの初期化
        Page1.SetActive(true);
        Page2.SetActive(false);
        Page3.SetActive(false);
    }
Example #3
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="Style" /> class.
        /// </summary>
        /// <param name="styleNode"> The style node. </param>
        /// <param name="storage"> The storage. </param>
        public Style(XmlNode styleNode, IPhysicalStorage storage)
        {
            _storage = storage;
              _id = styleNode.GetId();
              _isDefault = styleNode.GetAttributeBoolValue("isdefault");
              _name = styleNode.GetAttributeValue("name");

              _foregroundColor = styleNode.GetNodeColorValue("Foreground", "color");
              _font = styleNode.GetNodeValue("Foreground", "font");
              _fontSize = styleNode.GetNodeIntValue("Foreground", "fontsize");

              if (styleNode.HasNode("Background"))
              {
            _backgroundColor = styleNode.GetNodeColorValue("Background", "color");

            if (styleNode.HasNode("Background", "image"))
            {
              _backgroundImageUri = styleNode.GetNodeValue("Background", "image", "uri");

              var cache = styleNode.GetNodeValue("Background", "image", "cache");
              if (!string.IsNullOrEmpty(cache))
              {
            _backgroundImage = ImageSerializer.DeserializeBase64(cache);
              }
              else if (File.Exists(_backgroundImageUri))
              {
            _backgroundImage = Image.FromFile(_backgroundImageUri);
              }

              _transparency = styleNode.GetNodeIntValue("Background", "image", "transparency");
              _scale = styleNode.GetNodeBoolValue("Background", "image", "scale");
            }

            if (styleNode.HasNode("Title"))
            {
              _titleMode = TitleModeExtensions.AsTitleMode(styleNode["Title"].GetAttributeValue("mode"));

              if (styleNode.HasNode("Title", "Foreground"))
              {
            _titleForegroundColor = styleNode.GetNodeColorValue("Title", "Foreground", "color");
            _titleFont = styleNode.GetNodeValue("Title", "Foreground", "font");
            _titleFontSize = styleNode.GetNodeIntValue("Title", "Foreground", "fontsize");
              }
              if (styleNode.HasNode("Title", "Background"))
              {
            _titleBackgroundColor = styleNode.GetNodeColorValue("Title", "Background", "color");
              }
            }
              }
        }
Example #4
0
    private void OnSearch()
    {
        Debug.Log("OnSearch");

        // 入室可能なRoomへ入る
        StartCoroutine(GlobalGameManager._instance.photonManager.JoinRandomRoom());

        //
        Search.interactable = false;
        Create.interactable = false;
        Back.interactable   = false;

        //
        this.titleMode = TitleMode.Search_Wait;

        DisplayLog(">入室可能なRoom検索を実行しています...");
    }
Example #5
0
    private void OnExit()
    {
        Debug.Log("OnExit");

        // Page3 -> Page2への切替
        Page2.SetActive(true);
        Page3.SetActive(false);

        //
        this.titleMode = TitleMode.Exit_Wait;

        // Roomからの退室
        GlobalGameManager._instance.photonManager.ExitRoom();

        // ログ出力情報をクリアする。
        DisplayLogClear();
        DisplayLog(">Roomより退室しました。");
    }
Example #6
0
    private void OnCreate()
    {
        Debug.Log("OnCreate");

        // Roomを作成する
        StartCoroutine(GlobalGameManager._instance.photonManager.CreateRoom());

        //
        Search.interactable = false;
        Create.interactable = false;
        Back.interactable   = false;

        //
        this.titleMode = TitleMode.Create_Wait;

        //
        DisplayLog(">新しいRoomの作成を実行しています...");
    }
Example #7
0
    private void OnBack()
    {
        Debug.Log("OnBack");

        // ログ出力情報をクリアする。
        DisplayLogClear();

        // Page2 -> Page1への切替
        Page1.SetActive(true);
        Page2.SetActive(false);
        PlayerName.GetComponent <InputField>().interactable = true;


        // Photonとの接続解除
        GlobalGameManager._instance.photonManager.ClosePhotonConnect();

        //
        this.titleMode = TitleMode.Input_Wait;

        //
        DisplayLog(">ネットワークとの接続を解除しました。");
    }
Example #8
0
    private void RPC_GameStartWait()
    {
        Debug.Log("RPC_GameStartWait");

        // ゲーム開始待ちへ切り替え
        this.titleMode = TitleMode.Start_Wait;

        //
        this.waitTime = 0.0f;

        // ログ出力情報をクリアする。
        DisplayLogClear();

        // MasterClientのみ処理する
        if (GlobalGameManager._instance.photonManager.IsMasterClient() == true)
        {
            //
            this.startWaitTime = GlobalGameManager._instance.GAME_START_WAIT;

            // Roomへの入室禁止にする
            GlobalGameManager._instance.photonManager.RoomLock();

            // Room内のPlayerIDを取得
            // NOTE:ダイレクトではないのは一度、全体に共有しておきたかった
            //GlobalGameManager._instance.playerIds = GlobalGameManager._instance.photonManager.GetPlayerList();
            this.playerIds = GlobalGameManager._instance.photonManager.GetPlayerList();

            //
            //TODO:プレイヤーの人数は適切か?

            // 最初に鬼となるプレイヤーを決定
            //TODO:ちょっと固定にする
            //TODO:これって0が戻ることあるんだっけ?
            //this.startingOniId = this.playerIds[Random.Range((int)0, this.playerIds.Length)];
            this.startingOniId = 1;
        }
    }
Example #9
0
 protected void CheckSearchResult(List <TitleInfo> res, TitleMode mode, int index)
 {
     Assert.AreEqual(1, res.Count, "res.Count");
     Assert.AreEqual(mode, res[0].Mode, "Mode");
     Assert.AreEqual(index, res[0].IndexStartTitle, "IndexStartTitle");
 }
Example #10
0
 //タイトル画面のモードを設定する
 private void SetTitleMode(TitleMode destMode)
 {
     this.mode = destMode;
     Debug.Log($"mode : {mode.GetStringValue()}");
 }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        UI_DisplayGameVersion();

        // TODO:test こういうのもある!
        if (PhotonNetwork.isMasterClient == true)
        {
            Debug.Log("TestCounter");

/*
 *          ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
 *          customProp.Add("TestCounter", "aaaaa");
 *
 *          // カスタムPlayerプロパティの変更
 *          PhotonNetwork.SetPlayerCustomProperties(customProp);
 *
 *          // カスタムRoomプロパティの変更
 *          PhotonNetwork.room.SetCustomProperties(customProp);
 */
        }



        switch (this.titleMode)
        {
        case TitleMode.Input_Wait:
            break;

        case TitleMode.Entry_Wait:

            // Lobbyに入るまで待機
            if (GlobalGameManager._instance.photonManager.isJoinedLobby == true)
            {
                DisplayLog(">ネットワークへの接続が完了。");

                // Entryボタンへの入力受付状態に戻しておく
                Entry.interactable = true;

                // Page1 -> Page2への切替
                Page1.SetActive(false);
                Page2.SetActive(true);

                //
                this.titleMode = TitleMode.Input_Wait;
            }
            break;

        case TitleMode.Search_Wait:
        case TitleMode.Create_Wait:

            // Room検索の結果待ち
            if (GlobalGameManager._instance.photonManager.isJoinedRoom == true)
            {
                // Roomへの入室完了
                this.titleMode = TitleMode.Player_Wait;

                //
                Search.interactable = true;
                Create.interactable = true;
                Back.interactable   = true;

                // Page2 -> Page3への切替
                Page2.SetActive(false);
                Page3.SetActive(true);

                DisplayLog(">Roomへ入室しました。");
            }
            else if (GlobalGameManager._instance.photonManager.isJoinedRoom_Wait == false)
            {
                // 入室フラグの前に待ちフラグがリセットされた場合、入室失敗
                if (this.titleMode == TitleMode.Create_Wait)
                {
                    DisplayLog(">Roomの作成に失敗しました。");
                }
                else
                {
                    DisplayLog(">入室可能なRoomが存在しません。");
                }

                this.titleMode = TitleMode.Input_Wait;

                //
                Search.interactable = true;
                Create.interactable = true;
                Back.interactable   = true;
            }
            break;

        case TitleMode.Player_Wait:

            // ゲーム開始条件の確認し、OKならPlayボタンを解放する
            if (GameStartCheck() == true)
            {
                // Playボタンの解放
                Play.interactable = true;
            }
            else
            {
                // Room出入りによりボタンの状況は変化する
                Play.interactable = false;
            }
            break;

        case TitleMode.Exit_Wait:

            // Roomからの退出結果待ち
            if (GlobalGameManager._instance.photonManager.isExitRoom_Wait == false)
            {
                //
                this.waitTime = 0.0f;

                // Roomからの退出が確定
                this.titleMode = TitleMode.Input_Wait;

                //
                Search.interactable = true;
                Create.interactable = true;
                Back.interactable   = true;
            }
            else
            {
                Search.interactable = false;
                Create.interactable = false;
                Back.interactable   = false;
            }
            break;

        case TitleMode.Start_Wait:

            // 参加プレイヤーのIDを退避する
            GlobalGameManager._instance.playerIds = this.playerIds;

            // 最初の鬼IDを退避する
            // NOTE:RPC内の一度の設定では正しく退避できないので開始待ち時間の間に何度も退避する
            GlobalGameManager._instance.startingOniID = this.startingOniId;



            // ログ出力情報をクリアする。
            DisplayLogClear();
            DisplayLog(string.Format("ゲームを開始しています。{0:00.00}", this.startWaitTime));

            //
            DisplayLog("");
            DisplayLog("[playerIds]");
            for (int n = 0; n < this.playerIds.Length; n++)
            {
                DisplayLog(string.Format("[{0}]{1}", n, this.playerIds[n]));
            }

            // MasterClientのみ実行する
            if (GlobalGameManager._instance.photonManager.IsMasterClient() == true)
            {
                // 開始までのカウントダウン
                this.startWaitTime -= Time.deltaTime;

                // シーンの移動
                if (this.startWaitTime <= 0.0f)
                {
                    this.startWaitTime = 0.0f;
                    GlobalGameManager._instance.photonManager.SceneChangeGame("main");
                }
            }
            break;

        default:
            break;
        }
    }
Example #12
0
 public TitlePacket(TitleMode mode)
 {
     this.Id = mode == TitleMode.SetTitle ? 0x5A : 0x58;
 }