Inheritance: MonoBehaviour
示例#1
0
        public void JoinGame(Text ipAddressText)
        {
            if (ipAddressText.text == "")
            {
                ModalManager.GetInstance().Show(
                    "You need to enter an IP address to connect to",
                    "Try again",
                    () => { ModalManager.GetInstance().Hide(); }
                    );
                return;
            }

            NetworkManager.singleton.networkAddress = ipAddressText.text;
            if (NetworkManager.singleton.StartClient() == null)
            {
                ModalManager.GetInstance().Show(
                    "Connection not attempted to " + ipAddressText.text,
                    "Ok",
                    () => {
                    ModalManager.GetInstance().Hide();
                }
                    );
                return;
            }

            ModalManager.GetInstance().Show(
                "Attempting to join " + ipAddressText.text,
                "Cancel attempt",
                () => {
                NetworkManager.singleton.StopClient();
                ModalManager.GetInstance().Hide();
            }
                );
        }
示例#2
0
        public override void OnEnter()
        {
            //setup parameters
            for (int i = 0; i < paramNames.Length; i++)
            {
                var parmName = paramNames[i].Value;
                if (!string.IsNullOrEmpty(parmName))
                {
                    mParams[parmName] = paramObjects[i].GetValue();
                }
            }

            mMgr = manager.GetModalManager(Fsm);
            if (mMgr)
            {
                mMgr.Open(modal.Value, mParams);

                if (!waitClose.Value)
                {
                    Finish();
                }
            }
            else
            {
                Finish();
            }
        }
示例#3
0
        public async Task DeleteSupplier(Guid id)
        {
            var modalRes = await ModalManager.ConfirmationPopup("Confirm", "Supplier will be deleted. Are you sure?");

            if (!modalRes)
            {
                return;
            }

            try
            {
                var res = await Http.PostGetBaseResponseAsync("api/supplier/delete", id);

                if (res.Success)
                {
                    SupplierList.RemoveAll(i => i.Id == id);
                    //await loadList();
                }
            }
            catch (ApiException ex)
            {
                await ModalManager.ShowMessageAsync("Error", ex.Message);
            }
            catch (Exception ex)
            {
                await ModalManager.ShowMessageAsync("An Error", ex.Message);
            }
        }
示例#4
0
    private void prepareGameLevelIfNecessary()
    {
        if (!_isGameLevelPrepared)
        {
            //TODO put this code into a separate implementation of a "Level" interface
            //with methods such as "OnStartState", "OnGameState(bool isPause)" and so on
            //so that those modals don't appear on every level
            //Also: put specific interface elements into level scene and then move them to interface hierarchy

            mainMenu.setResume();

            //TODO remove this temporary hack
            switch (MemoryManager.get().configuration.getMode())
            {
            case GameConfiguration.GameMode.ADVENTURE:
                fadeSprite.gameObject.SetActive(true);
                ModalManager.setModal(intro, true, introContinueButton.gameObject, introContinueButton.GetType().Name);
                changeState(GameState.Pause);
                break;

            case GameConfiguration.GameMode.SANDBOX:
                break;

            default:
                Logger.Log("GameStateController::Update unknown game mode=" + MemoryManager.get().configuration.getMode(), Logger.Level.WARN);
                break;
            }
            _isGameLevelPrepared = true;
        }
    }
        /// <summary>
        /// Выполнение команды.
        /// </summary>
        public override void Execute()
        {
            var targetTraderViewModel = (ITraderViewModel)_playerState.HoverViewModel;
            var trader = targetTraderViewModel.Trader;

            ModalManager.ShowTraderModal(trader);
        }
示例#6
0
 public static ModalManager get() {
     if(_instance == null) {
         Logger.Log("ModalManager::get was badly initialized", Logger.Level.WARN);
         _instance = GameObject.Find(gameObjectName).GetComponent<ModalManager>();
     }
     return _instance;
 }
示例#7
0
        public void Start()
        {
            State.GetInstance().Subscribe(
                new StateOption().
                NetworkState(State.NETWORK_CLIENT).
                PreviousGameState(State.GAME_ONLINE).
                GameState(State.GAME_OFFLINE),
                () => {
                ModalManager.GetInstance().Show(
                    "Lost connection to server",
                    "Ok",
                    () => {
                    ModalManager.GetInstance().Hide();
                }
                    );
            }
                );

            State.GetInstance().Subscribe(
                new StateOption().
                NetworkState(State.NETWORK_CLIENT).
                PreviousGameState(State.GAME_CONNECTING).
                GameState(State.GAME_OFFLINE),
                () => {
                ModalManager.GetInstance().Show(
                    "Cannot establish connection to server",
                    "Ok",
                    () => {
                    ModalManager.GetInstance().Hide();
                }
                    );
            }
                );
        }
示例#8
0
        /// <summary>
        /// Выполнение команды.
        /// </summary>
        public override void Execute()
        {
            var targetTraderViewModel = (IActorViewModel)_playerState.HoverViewModel;
            var citizen = (CitizenPerson)targetTraderViewModel.Actor.Person;

            ModalManager.ShowDialogModal(citizen);
        }
 public void ShowTestAlert()
 {
     ModalManager.Show(null, "본 버전에서는 활력징후만 지원합니다.\r활력징후를 선택해주세요.", new[] { new ModalButton()
                                                                            {
                                                                                Text = "확인"
                                                                            } });
 }
 public void ShowTestCheckNullAlert()
 {
     ModalManager.Show(null, "상세 리스트를 선택 후 선택하기를 눌러주세요.", new[] { new ModalButton()
                                                                  {
                                                                      Text = "확인"
                                                                  } });
 }
 public void ShowModeAlert()
 {
     ModalManager.Show(null, $"본 버전에서는 학습하기만 지원합니다.{Environment.NewLine}학습하기를 선택해주세요.", new[] { new ModalButton()
                                                                                                {
                                                                                                    Text = "확인"
                                                                                                } });
 }
 public void ShowLearningAlert()
 {
     ModalManager.Show(null, "본 버전에서는 혈압측정만 체험 가능합니다.", new[] { new ModalButton()
                                                                {
                                                                    Text = "확인"
                                                                } });
 }
        /// <summary>
        /// Выполнение команды.
        /// </summary>
        public override void Execute()
        {
            var targetTraderViewModel = (IActorViewModel)_playerState.HoverViewModel;
            var trader = targetTraderViewModel.Actor.Person as CitizenPerson;

            ModalManager.ShowTraderModal(trader);
        }
示例#14
0
    public static void next()
    {
        Logger.Log("InfoWindowManager::next()", Logger.Level.INFO);
        ModalManager.unsetModal();
        _instance.gameStateController.tryUnlockPause();

        switch (_instance.nextAction)
        {
        case NextAction.GOTOWORLD:
            Logger.Log("InfoWindowManager::next GOTOWORLD", Logger.Level.DEBUG);
            break;

        case NextAction.GOTOEQUIP:
            Logger.Log("InfoWindowManager::next GOTOEQUIP", Logger.Level.DEBUG);
            GUITransitioner.get().GoToScreen(GUITransitioner.GameScreen.screen2);
            break;

        case NextAction.GOTOCRAFT:
            Logger.Log("InfoWindowManager::next GOTOCRAFT", Logger.Level.DEBUG);
            GUITransitioner.get().GoToScreen(GUITransitioner.GameScreen.screen3);
            break;

        default:
            Logger.Log("InfoWindowManager::next GOTOWORLD", Logger.Level.DEBUG);
            break;
        }
    }
示例#15
0
    void ParseCustomScript(string json)
    {
        RoleSelectionManager.CustomScriptData.Clear();

        List <string> missingIds = new List <string>();
        var           idList     = JsonConvert.DeserializeObject <List <IdWrapper> >(json);

        foreach (var id in idList)
        {
            RoleData roleData = Array.Find(RoleSelectionManager.RoleDataList, x => x.ScriptToolId == id.id);
            if (roleData == null)
            {
                missingIds.Add(id.id);
                continue;
            }

            RoleSelectionManager.CustomScriptData.Add(roleData);
        }

        RoleSelectionManager.OnCustomScriptLoaded();

        if (missingIds.Count > 0)
        {
            string errorMessage = "Failed to parse the following roles from the .json file:\n";
            errorMessage += string.Join(", ", missingIds);
            ModalManager.Instance().MessageBox(errorMessage, null, null, null, null, "Ok");
        }
    }
示例#16
0
    public override void press()
    {
        Logger.Log("EndRestartButton::press()", Logger.Level.INFO);

        //TODO manage stack of modal elements in ModalManager
        ModalManager.unsetModal();
        ModalManager.setModal("EndRestartGame");
    }
示例#17
0
    public override void press()
    {
        Logger.Log("EndMainMenuButton::press()", Logger.Level.INFO);
        URLOpener.open(studyURLKey, false);

        //if commented out, causes "enter" in the main menu at the end of the game to restart the game
        ModalManager.unsetModal();
        GameStateController.get().endGame();
    }
示例#18
0
    public void Start()
    {
        // Setup the singleton accessor
        Instance = this;

        // Test a dialog
        ModalManager = GetComponent <ModalManager>();
        Input        = new InputController();
    }
示例#19
0
 public static ModalManager get()
 {
     if (_instance == null)
     {
         Logger.Log("ModalManager::get was badly initialized", Logger.Level.WARN);
         _instance = GameObject.Find(gameObjectName).GetComponent <ModalManager>();
     }
     return(_instance);
 }
示例#20
0
    void Awake()
    {
        modalManager = ModalManager.Instance();
        levelManager = LevelManager.Instance();
        ship         = GameObject.FindGameObjectWithTag("Ship").GetComponent <Ship>();

        numberEnemiesDead = 0;
        enemySpawners     = GameObject.FindGameObjectsWithTag("Enemy Spawner");
    }
示例#21
0
        public override void Execute()
        {
            var inventory = _playerState.ActiveActor.Actor.Person.GetModule <IInventoryModule>();
            var targetContainerViewModel = (IContainerViewModel)_playerState.HoverViewModel;
            var container        = targetContainerViewModel.StaticObject;
            var containerContent = container.GetModule <IPropContainer>().Content;
            var transferMachine  = new PropTransferMachine(inventory, containerContent);

            ModalManager.ShowContainerModal(transferMachine);
        }
示例#22
0
    public override void press()
    {
        Logger.Log("StartGameButton::press()", Logger.Level.INFO);
        fadeSprite.FadeOut();

        //TODO manage stack of modal elements in ModalManager
        //ModalManager.unsetModal(parentPanel);
        ModalManager.unsetModal();
        GameStateController.get().tryUnlockPause();
    }
示例#23
0
        public override void Execute()
        {
            var inventory = _playerState.ActiveActor.Actor.Person.Inventory;
            var targetContainerViewModel = _playerState.HoverViewModel as IContainerViewModel;
            var container        = targetContainerViewModel.Container;
            var containerContent = container.Content;
            var transferMachine  = new PropTransferMachine(inventory, containerContent);

            ModalManager.ShowContainerModal(transferMachine);
        }
    private void Awake()
    {
        defaultTimeScale = Time.timeScale;
        Time.timeScale   = 0;

        //UserSonicObjectPrefab.SetActive(false);

        ObstacleSonicObjectPrefab.SetActive(false);
        TargetSonicObjectPrefab.SetActive(false);

        modalManager = GameObject.Find("Manager")
                       .GetComponent <ModalManager>();

        numActiveSpawnAreas = SpawnAreas.Length;
        availablePoints     = new List <Transform>();
        occupiedPoints      = new List <Transform>();

        foreach (var area in SpawnAreas)
        {
            var points = area.GetComponentsInChildren <Transform>();
            foreach (var point in points)
            {
                if (!area.transform.Equals(point))
                {
                    availablePoints.Add(point);
                }
            }
        }

        obstacleObjectInstances = new List <GameObject>();
        objectPointPairs        = new Dictionary <GameObject, Transform>();

        callbackDict = new Dictionary <string, System.Action <GameObject> >
        {
            [TARGETTAG]   = OnSucces,
            [OBSTACLETAG] = OnFailure
        };

        Transform[] walls = GameArea
                            .GetComponentsInChildren <Transform>();
        Transform leftWall   = walls[1];
        Transform rightWall  = walls[2];
        Transform topWall    = walls[3];
        Transform bottomWall = walls[4];

        float width  = rightWall.position.x - leftWall.position.x;
        float height = topWall.position.z - bottomWall.position.z;

        width  += rightWall.localScale.z;
        height += topWall.localScale.z;
        float x = -width / 2;
        float y = -height / 2;

        areaBounds = new Rect(x, y, width, height);
    }
    public override void press()
    {
        Logger.Log("GenericDisplayModalButton::press() with modalCode=" + modalCode, Logger.Level.INFO);

        //TODO manage stack of modal elements in ModalManager
        if (unsetModal)
        {
            ModalManager.unsetModal();
        }
        ModalManager.setModal(modalCode);
    }
示例#26
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#27
0
        public override void Execute()
        {
            var actor = _playerState.ActiveActor?.Actor;

            if (actor is null)
            {
                throw new InvalidOperationException();
            }

            ModalManager.ShowInventoryModal(actor);
        }
示例#28
0
    private static ModalManager MainModalManager; //Reference to the Modal Panel, to make sure it's been included

    public static ModalManager Instance()
    {
        if (!MainModalManager)
        {
            MainModalManager = FindObjectOfType(typeof(ModalManager)) as ModalManager;
            if (!MainModalManager)
            {
                Debug.LogError("There needs to be one active ModalPanel script on a GameObject in your scene.");
            }
        }
        return(MainModalManager);
    }
示例#29
0
    public override void press()
    {
        Logger.Log("ContinueButton::press()", Logger.Level.INFO);

        parentPanel = gameObject.transform.parent.gameObject;

        //TODO manage stack of modal elements in ModalManager
        //ModalManager.unsetModal(parentPanel);
        ModalManager.unsetModal();
        GameStateController.get().tryUnlockPause();

        ModalManager.setModal(nextInfoPanel, true, nextInfoPanelContinue.gameObject, nextInfoPanelContinue.GetType().AssemblyQualifiedName);
    }
示例#30
0
 public static bool displayInfoWindow(string code)
 {
     if (fillInFieldsFromCode(code))
     {
         ModalManager.setModal(_instance.infoPanel);
         return(true);
     }
     else
     {
         Logger.Log("InfoWindowManager::displayInfoWindow(" + code + ") failed", Logger.Level.WARN);
         return(false);
     }
 }
示例#31
0
 public ProfileConnector(
     UserStorage userStorage,
     AppServerManager appServerManager,
     AppSettings appSettings,
     ApiServerConnector apiServerConnector,
     ModalManager modalManager)
 {
     _modalManager       = modalManager;
     _userStorage        = userStorage;
     _appServerManager   = appServerManager;
     _appSettings        = appSettings;
     _apiServerConnector = apiServerConnector;
 }
示例#32
0
 void Awake()
 {
     Logger.Log("ModalManager::Awake", Logger.Level.DEBUG);
     _instance = this;
     loadDataIntoDico(inputFiles, _loadedModalWindows);
 }