コード例 #1
0
        void Start()
        {
            this.UpdateAsObservable()
            .TakeUntilDestroy(this)
            .Where(_ => PhotonNetwork.PlayerList.Length >= 2)
            .Take(1)
            .Delay(TimeSpan.FromMilliseconds(1000))
            .Subscribe(async _ =>
            {
                Transform pos = CreatePos[TestOnlineData.PlayerID - 1];
                //Debug.Log(TestOnlineData.PlayerID);
                // オブジェクトの生成
                GameObject obj        = Instantiate(playerPrefab, pos.position, pos.rotation);
                GameObject displayObj = PhotonNetwork.Instantiate("DisplayPlayer", pos.position, pos.rotation);
                displayObj.GetComponent <DisplayPlayerProvider>().MyID = TestOnlineData.PlayerID;

                SetDisplay setDisp  = obj.GetComponent <SetDisplay>();
                GameObject[] setPos = setDisp.Display;

                // 生成オブジェクトの手を格納する配列
                PlayerHand[] setWeaponHandArray = new PlayerHand[2];

                for (int i = setPos.Length - 1; i >= 0; i--)
                {
                    // オブジェクトにPlayerHandが付いていたら、そのオブジェクトを武器に知らせる
                    PlayerHand tmp = displayObj.transform.GetChild(i).GetComponent <PlayerHand>();

                    // オブジェクトの親を変更
                    // PlayerHandの処理を先にしないと、親子関係の数が狂っておかしくなるため、取得を先にする
                    displayObj.transform.GetChild(i).transform.SetParent(setPos[i].transform, false);

                    // PlayerHandがついていなければここで処理を終了
                    if (tmp == null)
                    {
                        continue;
                    }

                    // 0が右手、1が左手
                    if (tmp.myTouch == OVRInput.RawButton.RHandTrigger)
                    {
                        setWeaponHandArray[0] = tmp;
                    }
                    else
                    {
                        setWeaponHandArray[1] = tmp;
                    }
                }

                // Playerの生成を通知
                await UniTask.Delay(1000);

                // イベントを発行
                OnPlayerCreate?.Invoke(setWeaponHandArray);
            });
        }
コード例 #2
0
    public WallPaperEngine()
    {
        //下記処理(レジストリを)をリセットする
        this.FormClosing += Form1_FormClosing;

        //IEのレジストリキーを登録
        regkey.SetValue(process_name, 11001, Microsoft.Win32.RegistryValueKind.DWord);
        regkey.SetValue(process_dbg_name, 11001, Microsoft.Win32.RegistryValueKind.DWord);

        //壁紙にFormを張り付ける
        IntPtr progman = IntPtr.Zero;

        progman = Wallpainter.SetupWallpaper();
        if (progman == IntPtr.Zero)
        {
            writeLog("Error : Failed to retrieve progman!");
        }
        if (WinAPI.SetParent(this.Handle, progman) == IntPtr.Zero)
        {
            writeLog("Error : Failed to set Parent!");
        }
        WinAPI.ShowWindowAsync(this.Handle, 1);

        // フォームの設定
        writeLog("init Form");
        this.Text            = "WallPaperEngine";
        this.FormBorderStyle = FormBorderStyle.None;
        SetDisplay setdsp = new SetDisplay(this);

        setdsp.setPrimaryDsp();

        // フォーム内のパーツ
        writeLog("init form parts");
        this.elementHost  = new System.Windows.Forms.Integration.ElementHost();
        this.mediaElement = new System.Windows.Controls.MediaElement();
        this.contextMenu  = new System.Windows.Forms.ContextMenu();
        //TODO : MenuItemを配列として定義に変更
        this.menuItem0  = new System.Windows.Forms.MenuItem();
        this.menuItem1  = new System.Windows.Forms.MenuItem();
        this.menuItem2  = new System.Windows.Forms.MenuItem();
        this.menuItem3  = new System.Windows.Forms.MenuItem();
        this.menuItem4  = new System.Windows.Forms.MenuItem();
        this.menuItem5  = new System.Windows.Forms.MenuItem();
        this.notifyIcon = new System.Windows.Forms.NotifyIcon();
        this.webBrowser = new System.Windows.Controls.WebBrowser();

        // mediaElementを置くためのパーツ
        writeLog("init elementHost");
        this.elementHost.Visible = true;
        this.elementHost.Dock    = DockStyle.Fill;
        this.Controls.Add(this.elementHost);

        // 動画再生パーツ
        writeLog("init mediaElement");
        this.mediaElement.Visibility       = System.Windows.Visibility.Visible;
        this.mediaElement.Margin           = new System.Windows.Thickness(0, 0, 0, 0);
        this.mediaElement.UnloadedBehavior = System.Windows.Controls.MediaState.Manual;
        this.mediaElement.MediaEnded      += (sender, eventArgs) =>   {
            this.mediaElement.Position = TimeSpan.FromMilliseconds(1);
            this.mediaElement.Play();
        };
        this.elementHost.Child = this.mediaElement;

        writeLog("init webBrowser");
        this.webBrowser.Visibility = System.Windows.Visibility.Visible;
        this.webBrowser.Margin     = new System.Windows.Thickness(0, 0, 0, 0);

        // 動画ソースの読み込み
        writeLog("load video");
        loadVideo();

        // メニューにmenuItemを追加
        writeLog("add notifyIcon");
        this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem0, this.menuItem1, this.menuItem2, this.menuItem3, this.menuItem4, this.menuItem5 });


        // menuItem0として終了ボタンを追加
        this.menuItem0.Index  = 0;
        this.menuItem0.Text   = "E&xit";
        this.menuItem0.Click += new System.EventHandler(this.menuItem0_Click);

        // menuItem1としてミュートボタンを追加
        this.menuItem1.Index   = 1;
        this.menuItem1.Text    = "Mute Audio";
        this.menuItem1.Click  += new System.EventHandler(this.menuItem1_Click);
        this.menuItem1.Checked = this.mediaElement.IsMuted;

        // menuItem2としてロードビデオボタンを追加
        this.menuItem2.Index  = 2;
        this.menuItem2.Text   = "Load Video";
        this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);

        // menuItem3としてロードURLボタンを追加
        this.menuItem3.Index  = 3;
        this.menuItem3.Text   = "Load URL";
        this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);

        // menuItem4として「作者に奢る」ボタンを追加
        this.menuItem4.Index  = 5;
        this.menuItem4.Text   = "作者に奢る";
        this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);

        // menuItem5としてターゲットディスプレイボタンを追加
        this.menuItem5.Index = 4;
        this.menuItem5.Text  = "Target Display";
        MenuItem5_subMenu_utility submenu_utility = new MenuItem5_subMenu_utility(setdsp);

        //接続されているディスプレイの数だけmenuItem5にサブメニューを追加
        Screen[] sc_array = System.Windows.Forms.Screen.AllScreens;
        foreach (Screen sc in sc_array)
        {
            System.Windows.Forms.MenuItem submenuItem = new MenuItem();
            submenuItem.Text   = sc.DeviceName;
            submenuItem.Click += submenu_utility.menuItem5_subMenu_Click(sc);
            submenu_utility.addSubMenuItem(submenuItem);
            this.menuItem5.MenuItems.Add(submenuItem);
        }

        // タスクトレイのアイコンの設定
        this.notifyIcon.Icon        = new Icon("favicon.ico");
        this.notifyIcon.ContextMenu = this.contextMenu;
        this.notifyIcon.Text        = this.Text;
        this.notifyIcon.Visible     = true;
    }
コード例 #3
0
 public MenuItem5_subMenu_utility(SetDisplay setdsp)
 {
     this.setdsp_ = setdsp;
 }