Beispiel #1
0
    private IEnumerator WaitForTownOpenEffect(UIIcon icon)
    {
        m_isCloseLock = true;

        SoundManager.instance.PlayAudioClip("UI_Opentown");

        GameObject effect = Instantiate(AssetBundleEx.Load <GameObject>("[Prefabs]/[Effects]/FX_town_building_open")) as GameObject;

        effect.transform.position = icon.GetTransform.position;
        Util.SetGameObjectLayer(effect, LayerMask.NameToLayer("UIEffect"));

        yield return(new WaitForSeconds(1.5f));

        icon.Update();
        DestroyImmediate(effect);

        switch (StateManager.instance.m_curStateType)
        {
        case STATE_TYPE.STATE_ROOM:
            break;

        case STATE_TYPE.STATE_VILLAGE:
            GUIManager_Village guiVillage = ((State_Village)StateManager.instance.m_curState).m_guiVillageManager;
            guiVillage.HIdeAndLockUI();

            yield return(new WaitForSeconds(0.5f));

            break;
        }

        m_isCloseLock = false;

        NetworkManager.instance.SendTownEnter(WorldManager.instance.m_player.m_lastTown);
    }
Beispiel #2
0
    private void OnTownButtonClick(ICON_TYPE type)
    {
        TownInfo info = WorldManager.instance.m_dataManager.m_townData.GetTownInfoTable(GetTownCode(type));

        if (info != null)
        {
            bool isUser      = StateManager.instance.m_curState.GetIsUser();
            int  curLastTown = isUser ? WorldManager.instance.m_player.m_lastTown : WorldManager.instance.m_player.m_Friend.m_curFriendLastTownNo;

            bool isLock            = info.index > curLastTown;
            bool isUnlockAvailable = info.openLevel <= WorldManager.instance.m_player.m_level;

            if (isLock)
            {
                if (isUnlockAvailable && isUser)
                {
                    switch (StateManager.instance.m_curStateType)
                    {
                    case STATE_TYPE.STATE_ROOM:
                        GUIManager_Room guiRoom = ((State_Room)StateManager.instance.m_curState).m_guiManager;
                        guiRoom.GetStateRoom().m_camManager.OrderCameraActive(false);
                        guiRoom.OnOffClickLcokBtnCollider(true);
                        break;

                    case STATE_TYPE.STATE_VILLAGE:
                        GUIManager_Village guiVillage = ((State_Village)StateManager.instance.m_curState).m_guiVillageManager;
                        guiVillage.SetControlActive(false);
                        break;
                    }

                    NetworkManager.instance.SendTownOpen(info.index);
                }
            }

            else
            {
                switch (StateManager.instance.m_curStateType)
                {
                case STATE_TYPE.STATE_ROOM:
                    GUIManager_Room guiRoom = ((State_Room)StateManager.instance.m_curState).m_guiManager;
                    guiRoom.GetStateRoom().m_camManager.OrderCameraActive(false);
                    guiRoom.OnOffClickLcokBtnCollider(true);
                    break;

                case STATE_TYPE.STATE_VILLAGE:
                    if (WorldManager.instance.m_town.CurrentTownCode.Equals(info.index))
                    {
                        return;
                    }

                    GUIManager_Village guiVillage = ((State_Village)StateManager.instance.m_curState).m_guiVillageManager;
                    guiVillage.HIdeAndLockUI();
                    break;
                }

                if (isUser)
                {
                    NetworkManager.instance.SendTownEnter(info.index);
                }
                else
                {
                    NetworkManager.instance.SendSocTownEnter(WorldManager.instance.m_player.m_Friend.m_CurFriendNo, info.index);
                }
            }
        }
    }