示例#1
0
        private void OnOpenUIFormSuccess(object sender, GameEventArgs e)
        {
            OpenUIFormSuccessEventArgs ne = (OpenUIFormSuccessEventArgs)e;

            // 判断userData是否为自己
            if (ne.UserData != this)
            {
                return;
            }
            if (sender != null)
            {
                UIComponent UI = sender as UIComponent;
                if (UI != null)
                {
                    UIForm form = UI.GetUIForm(mUIName);
                    if (form != null)
                    {
                        GameUICanvas panel = (GameUICanvas)(form.Logic);
                        if (panel != null)
                        {
                            //panel.OnEnableMask(true);
                            //panel.OnEnableActor(true);
                        }
                    }
                }
            }
        }
示例#2
0
 void Awake()
 {
     instance = this;
 }
示例#3
0
    IEnumerator C_Initialize()
    {
        WaitForSeconds wait = new WaitForSeconds(0.5f);

        if (GameManager.Instance.m_TestMode)
        {
            TestModeDefaultItemSetting list = Resources.Load <TestModeDefaultItemSetting>("TestModeDefaultItemList");
            list.SetTestDefaultItemInventory();

            TestModeServerConnect();
            while (!PhotonNetwork.InRoom)
            {
                yield return(null);
            }
        }

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties(PlayerCharacter.m_CharacterReadyKey, false);
        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", false);

        yield return(wait);

        if (PhotonNetwork.IsMasterClient)
        {
            // timer set
            TimerNet.CreateDefaultTimer();
            TimerNet.InsertTimer(m_SequenceTimerKey, 0.0f, true);
        }

        yield return(wait);

        GameObject pianoUI = Instantiate(Resources.Load <GameObject>("PianoEffectCanvas"));

        m_PianoEffect = pianoUI.GetComponent <PianoEffectCanvas>();
        m_PianoEffect.Initialize();
        GameObject readyUI = Instantiate(Resources.Load <GameObject>("GameReadyCanvas"));

        m_GameReadyCanvas = readyUI.GetComponent <GameReadyCanvas>();
        m_ControlCanvas   = Instantiate(Resources.Load <GameObject>("ControlCanvas"));
        m_ControlCanvas.SetActive(false);
        GameObject gameUI = Instantiate(Resources.Load <GameObject>("GameUICanvas"));

        m_GameUICanvas = gameUI.GetComponent <GameUICanvas>();
        List <Item> droplist = new List <Item>();

        for (int i = 0; i < m_DropItemList.Length; ++i)
        {
            droplist.Add(m_DropItemList[i].m_Item);
        }
        m_GameUICanvas.Initialize(this, droplist);
        m_GameUICanvas.TimeCheck(false);
        gameUI.SetActive(false);
        m_SkillUICanvas = Instantiate(Resources.Load <GameObject>("SkillUICanvas"), Vector3.zero, Quaternion.identity);
        m_SkillUICanvas.SetActive(false);
        GameObject bossUI = Instantiate(Resources.Load <GameObject>("BossUICanvas"));

        m_BossUICanvas = bossUI.GetComponent <BossCharacterUI>();
        bossUI.SetActive(false);
        m_SpawnManager.Initialize();

        GameObject g = PhotonNetwork.Instantiate("PlayerCharacter", Vector3.zero, Quaternion.identity, 0, new object[] { -1, -1, -1, -1, -1, InventoryManager.Instance.GetPlayerModelName() });

        m_MyCharacter = g.GetComponent <PlayerCharacter>();
        m_MyCharacter.AddDeadEvent(MyCharacterDeadEvent);

        m_VerticalCamera = Instantiate(m_VerticalCamera, Vector3.zero, Quaternion.identity);
        VerticalFollowCamera verticalcamera = m_VerticalCamera.GetComponent <VerticalFollowCamera>();

        verticalcamera.Initialize(this, m_MyCharacter);
        m_VerticalCamera.SetActive(false);

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", true);

        yield return(wait);

        while (!IsBeginLoadingComplete)
        {
            Player[] players     = PhotonNetwork.PlayerList;
            int      compcount   = 0;
            int      playercount = players.Length;

            foreach (Player p in players)
            {
                if (NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(p, "InitComp"))
                {
                    ++compcount;
                }
            }

            if (compcount >= playercount)
            {
                IsBeginLoadingComplete = true;
            }
            yield return(null);
        }

        m_IsMultiplayGame = NetworkManager.Instance.RoomController.GetRoomPropertie <bool>(MultiPlayKey);

        while (!IsAfterLoadingComplete)
        {
            Player[] players = PhotonNetwork.PlayerList;

            bool complete = true;
            for (int i = 0; i < players.Length; ++i)
            {
                if (!NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(players[i], PlayerCharacter.m_CharacterReadyKey))
                {
                    complete = false;
                }
            }
            if (complete)
            {
                InitializeComplete();
            }
            yield return(null);
        }
    }