Esempio n. 1
0
    private void WaitingButton()
    {
        Content nextContent = null;

        if (!waitContentHold)
        {
            if (curOrderIndex < DataSorter.instance.curContentList.Length - 1)
            {
                //   Debug.Log(" isEnterTriggerArea is on and play next dialog");
                curOrderIndex++;
                nextContent    = DataSorter.instance.curContentList[curOrderIndex];
                curContent     = nextContent;
                curDialogState = DialogState.playDialog;
            }
            else
            {
                Debug.Log("dialog is end .sequencer will wait next trigger ");
                DataSorter.instance.curDialogIndex++;
                curDialogState = DialogState.waitTrigger;
                //turn off trigger enter bool state
                //   isEnterTriggerArea = false;

                LoadNextContentList(DataSorter.instance.curDialogIndex);
            }
        }

        curTime = 0;
    }
Esempio n. 2
0
        public SupplyDialog(DialogState dialogState, long?id = null) : base(dialogState, id)
        {
            if (id.HasValue)
            {
                _supply           = EntityManager.GetSupply(id.Value);
                Organization      = _supply.GetOrganization();
                ResponsiblePerson = _supply.GetResponsiblePerson();
                Bill = _supply.GetBill();
            }
            else
            {
                _supply = new Supply()
                {
                    SupplyId = EntityManager.GetNextSupplyId()
                };

                Bill = new Bill()
                {
                    BillId   = EntityManager.GetNextBillId(),
                    SupplyId = _supply.SupplyId
                };
            }

            InitializeComponentAndSetDialogButtons();
        }
Esempio n. 3
0
 void NavigateFromStart(AuroraDLG.AStarting start)
 {
     Debug.Log("Navigating from start");
     // Find the entry this start points to
     curEntry = GetEntry((int)start.Index);
     mode     = DialogState.CHOOSING_REPLY;
 }
Esempio n. 4
0
        private IState InitializeStates()
        {
            var toBeContinued = new ToBeContinuedState();

            var dialogOptions = new List <IState>()
            {
                new DialogOptionState("Option 1 was chosen"),
                new DialogOptionState("Option 2 was chosen"),
                new DialogOptionState("Option 3 was chosen")
            };

            dialogOptions.ForEach(x => x.AddState(StandardCommands.ToBeContinued, toBeContinued));

            var dialogState = new DialogState();

            dialogState.AddState(StandardCommands.DialogOptionOne, dialogOptions[0]);
            dialogState.AddState(StandardCommands.DialogOptionTwo, dialogOptions[1]);
            dialogState.AddState(StandardCommands.DialogOptionThree, dialogOptions[2]);

            var meetingState = new MeetingState();

            meetingState.AddState(StandardCommands.OpenDialog, dialogState);
            meetingState.AddState(StandardCommands.AnotherOption, new SomeState());

            var startState = new StartState();

            startState.AddState(StandardCommands.MeetCharacter, meetingState);

            return(startState);
        }
Esempio n. 5
0
 public SequenceContext(DialogSet dialogs, DialogContext dc, DialogState state, List <ActionState> actions, string changeKey, DialogSet actionDialogs)
     : base(dialogs, dc, state)
 {
     this.Actions       = actions;
     this.changeKey     = changeKey;
     this.actionDialogs = actionDialogs;
 }
Esempio n. 6
0
 void ToChooseReply(AuroraDLG.AReply.AEntries replyEntry)
 {
     Debug.Log("Navigating from reply");
     curEntry = GetEntry((int)replyEntry.Index);
     curReply = null;
     mode     = DialogState.CHOOSING_REPLY;
 }
Esempio n. 7
0
        public async Task DisplayDialog(string msg, string asset)
        {
            var dialogState = new DialogState(gameManager.Game, msg, asset, false);

            gameManager.PushState(dialogState);
            await dialogState.tcs.Task;
        }
Esempio n. 8
0
 public BaseDialogViewModel(UserControl dialog, Type type)
 {
     this.dialog = dialog;
     this.type   = type;
     dialogState = DialogState.View;
     items       = new ObservableCollection <Entity>();
 }
Esempio n. 9
0
 public BotStateService(UserState userState, ConversationState conversationState, DialogState dialogState)
 {
     UserState         = userState;
     ConversationState = conversationState;
     DialogState       = dialogState;
     InitializeAccessors();
 }
Esempio n. 10
0
 public void StartDialog()
 {
     _dialogState = DialogState.Dialoguing;
     StartCoroutine(LookAtCamera(Camera.main.transform));
     _dialogPanel.gameObject.SetActive(true);
     NextDialogStep();
 }
 private void startingStatementUpdate()
 {
     if (continueButtonPressed())
     {
         if (currentDialog.startingStatement.advanceIndex())
         {
             currentStatement = currentDialog.startingStatement;
             playCurrentStatement(PortraitType.Normal);
         }
         else
         {
             if (gameStateManager.getCurrentTimeState() == TimeState.DateSelection)
             {
                 if (gameStateManager.isLastDay())
                 {
                     ui.displayDateChoices(accusations[currentCharacterId]);
                     dialogState = DialogState.AccuseChoice;
                 }
                 else
                 {
                     ui.displayDateChoices(dates[currentCharacterId]);
                     dialogState = DialogState.AskOnDateChoice;
                 }
             }
             else
             {
                 ui.displayChoices(currentDialog);
                 dialogState = DialogState.DisplayingChoices;
             }
         }
     }
 }
    public void initiateDialog(int characterId)
    {
        currentAccidentId = gameStateManager.currentAccidentId();
        ui.repositionCanvas(mainCamera.transform);
        currentCharacterId = characterId;
        selectCurrentDialog();
        mainCamera.cullingMask = 0 | (1 << 5);

        currentDialog.startingStatement.resetIndex();

        if (characterId != 0)
        {
            currentStatement = currentDialog.startingStatement;
            playCurrentStatement(PortraitType.Normal);
            dialogState = DialogState.StartingStatement;
        }
        else
        {
            personInformation[currentCharacterId].advanceIndex();
            currentStatement = personInformation[currentCharacterId].currentInfo();
            pickedAccident   = false;
            currentStatement.resetIndex();
            playCurrentStatement(PortraitType.Normal);
            dialogState = DialogState.ShowingInfoStatement;
        }
    }
Esempio n. 13
0
        /// <summary>
        /// Opens dialog, waits for input, then closes
        /// </summary>
        protected IEnumerator RunDialogOverTime()
        {
            // Create buttons and set up message
            GenerateButtons();
            SetTitleAndMessage();
            FinalizeLayout();

            // Open dialog
            State = DialogState.Opening;
            yield return(StartCoroutine(OpenDialog()));

            State = DialogState.WaitingForInput;
            // Wait for input
            while (State == DialogState.WaitingForInput)
            {
                UpdateDialog();
                yield return(null);
            }
            // Close dialog
            State = DialogState.Closing;
            yield return(StartCoroutine(CloseDialog()));

            State = DialogState.Closed;
            // Callback
            OnClosed?.Invoke(result);
            // Wait a moment to give scripts a chance to respond
            yield return(null);

            // Destroy ourselves
            Destroy(gameObject);
            yield break;
        }
 public CustomDialogSequence(CombatGameState Combat, CombatHUDDialogSideStack sideStack,
                             bool isCancelable = true) : base(Combat)
 {
     this.isCancelable = isCancelable;
     this.sideStack    = sideStack;
     this.state        = DialogState.None;
 }
Esempio n. 15
0
        void drd_LostFocused(IFocusable sender, FocusEventArgs args)
        {
            var      baseDialog = sender as GeneralDialogBase;
            ItemType itemType   = ItemType.None;

            if (baseDialog is GeneralDialog && ((GeneralDialog)baseDialog).OK)
            {
                UseItem            = ((ItemsComponent)mainSprite.GetChildAt(selection)).Items[0];
                stackObject.Hidden = false;
                itemType           = UseItem.ItemType;
            }
            else if (baseDialog is SuperAutoDialog && ((SuperAutoDialog)baseDialog).OK)
            {
                UseItem  = ((ItemsComponent)mainSprite.GetChildAt(selection)).Items[0];
                itemType = (ItemType)(((SuperAutoDialog)baseDialog).Result + 1);
                UseItem["SubItemType"] = itemType;
                stackObject.Hidden     = false;
            }
            if (itemType == ItemType.Auto3 || itemType == ItemType.Auto4)
            {
                dialogState = DialogState.WaitIncludeFine;
            }
            this.RemoveChild(baseDialog);
            baseDialog.Dispose();
        }
Esempio n. 16
0
        private void OnDialogStateChanged(object sender, DialogState e)
        {
            if (sender is IDialog dialog)
            {
                switch (e)
                {
                case DialogState.Active:
                    if (ActiveDialogs.Contains(dialog))
                    {
                        return;
                    }
                    MinimizedDialogs.RemoveIfExists(dialog);
                    ActiveDialogs.Add(dialog);
                    break;

                case DialogState.Minimized:
                    if (MinimizedDialogs.Contains(dialog))
                    {
                        return;
                    }
                    ActiveDialogs.RemoveIfExists(dialog);
                    MinimizedDialogs.Add(dialog);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(e), e, null);
                }
                DialogStateChanged?.Invoke(this, dialog);
            }
        }
Esempio n. 17
0
    public static void FloatLine(this GameObject obj, int lineNumber, GameObject listener)
    {
        var script = obj.GetScript(obj_f.scripts_idx, (int)ObjScriptEvent.Dialog);

        if (!GameSystems.ScriptName.TryGetDialogScriptPath(script.scriptId, out var dialogScriptPath))
        {
            throw new ArgumentException($"Invalid dialog script {script.scriptId} attached to NPC.");
        }

        if (!GameSystems.Dialog.TryLoadDialog(script.scriptId, out var dialogScript))
        {
            throw new KeyNotFoundException($"Could not load dialog file {dialogScriptPath}");
        }

        var dialog_slot_idx = new DialogState(obj, listener);

        dialog_slot_idx.dialogScript   = dialogScript;
        dialog_slot_idx.reqNpcLineId   = lineNumber;
        dialog_slot_idx.dialogScriptId = script.scriptId;
        // [TempleDllLocation(0x10038590)]
        dialog_slot_idx.lineNumber = lineNumber;
        dialog_slot_idx.actionType = 0;
        GameSystems.Dialog.DialogGetNpcLine(dialog_slot_idx, false);
        GameSystems.Script.ShowTextBubble(obj, listener, dialog_slot_idx.npcLineText, dialog_slot_idx.speechId);

        GameSystems.Dialog.Free(ref dialog_slot_idx.dialogScript);
    }
 public void ShowMessageDialog(string message, string caption, DialogState state = DialogState.Alert)
 {
     Header = caption;
     TxtMessageText.Text = message;
     Show();
     Visibility = Visibility.Visible;
     BtnOk.Focus();
 }
Esempio n. 19
0
        /// <summary>
        /// Apply given input on given state.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="state"></param>
        /// <returns>State after input application.</returns>
        private DialogState applyInput(DialogActBase input, DialogState state)
        {
            var processor = new InputProcessor(state);

            input.Visit(processor);

            return(processor.Output);
        }
Esempio n. 20
0
    public void LoadDLG(AuroraDLG dlg)
    {
        curEntry = null;
        curReply = null;

        this.dlg = dlg;
        mode     = DialogState.STARTING;
    }
Esempio n. 21
0
 /// <summary>
 /// Dừng một đoạn hội thoại, đồng thời deactivate DialogObject
 /// </summary>
 public void PauseDialog()
 {
     if (this.State != DialogState.Running)
     {
         return;
     }
     this.animator.SetBool("dialogActive", false);
     this.State = DialogState.Pause;
 }
Esempio n. 22
0
 public DialogBlurb(string text, DialogState from, DialogState to, DialogBlurb dependentOnLine, Character character)
 {
     m_text            = text;
     m_from            = from;
     m_to              = to;
     m_dependentOnLine = dependentOnLine;
     m_said            = false;
     m_character       = character;
 }
Esempio n. 23
0
 /// <summary>
 /// ダイアログを閉じる
 /// </summary>
 private void CloseDialog()
 {
     if (state == DialogState.Hide)
     {
         return;
     }
     alpha = 1f;
     state = DialogState.Hide;
 }
Esempio n. 24
0
        private void UpdateActionScopeState(DialogContext dc, DialogState state)
        {
            var activeDialogState = dc.ActiveDialog?.State as Dictionary <string, object>;

            if (activeDialogState != null)
            {
                activeDialogState[ActionScopeState] = state;
            }
        }
Esempio n. 25
0
    public DialogPrinter(string text, float interval, MonoBehaviour objectBehaviour)
    {
        currentState  = DialogState.none;
        currentText   = "";
        totalText     = text;
        this.interval = interval;

        objectBehaviour.StartCoroutine(PrintText());
    }
        btnCreate_Click
        (
            object sender,
            EventArgs e
        )
        {
            AssertValid();

            switch (this.State)
            {
            case DialogState.Idle:

                if (!m_oSubgraphImageCreator.IsBusy)
                {
                    if (DoDataExchange(true))
                    {
                        if (m_eMode == DialogMode.EditOnly)
                        {
                            this.Close();
                            return;
                        }
                        else
                        {
                            this.State = DialogState.CreatingSubgraphImages;
                            StartImageCreation();
                        }
                    }
                }

                break;

            case DialogState.CreatingSubgraphImages:

                if (m_oSubgraphImageCreator.IsBusy)
                {
                    // Request to cancel image creation.  When the request is
                    // completed, SubgraphImageCreator_ImageCreationCompleted()
                    // will be called.

                    m_oSubgraphImageCreator.CancelAsync();
                }

                break;

            case DialogState.PopulatingImageColumn:

                // (Do nothing.)

                break;

            default:

                Debug.Assert(false);
                break;
            }
        }
Esempio n. 27
0
 private IEnumerator <object> ShowTask(string animation)
 {
     State = DialogState.Showing;
     Orientate();
     if (animation != null && Root.TryRunAnimation(animation))
     {
         yield return(Root);
     }
     State = DialogState.Shown;
 }
Esempio n. 28
0
 private IEnumerator <object> CloseTask(string animation)
 {
     State = DialogState.Closing;
     if (animation != null && Root.TryRunAnimation(animation))
     {
         yield return(Root);
     }
     UnlinkAndDispose();
     State = DialogState.Closed;
 }
Esempio n. 29
0
 public void SelectOption(int optionID, System.Action <int> optionSelectHandler)
 {
     if (ds != DialogState.Choices)
     {
         Debug.LogWarning("An option was selected, but the dialogue UI was not expecting it.");
         return;
     }
     ds = DialogState.Rolled;
     optionSelectHandler?.Invoke(optionID);
 }
Esempio n. 30
0
 /// <summary>
 /// Kết thúc trực tiếp 1 đoạn hội thoại, đồng thời deactivate DialogObject
 /// </summary>
 public void EndDialog()
 {
     this.dialogData.End();
     this.currentDialogID = -1;
     VD.EndDialogue();
     VD.OnNodeChange -= this.OnDialogChanged;
     OnDialogEnd?.Invoke();
     this.State = DialogState.NotActive;
     this.animator.SetBool("dialogActive", false);
 }
Esempio n. 31
0
    public void Hide(bool suppressEvents)
    {
        currentDialog = null;

        if (!suppressEvents)
        {
            onHide.ForEach(s => s.Fire());
        }

        state = DialogState.Hidden;
    }
    public void KeepGoing()
    {
        isAction = true;

        if (state == DialogState.WAIT || state == DialogState.AUTOREAD)
        {
            arrowWait.SetActive(false);
            state = DialogState.SCROLL;
        }

        if (indexText >= text.Length)
            EndDialog();
    }
    public void StartDialog(string textDial, bool autoRead = false)
    {
        this.enabled = true;
        EnableDialog();
        this.text = textDial;
        indexText = 0;
        dialogText.text = "";
        builder = new StringBuilder(text);

        if (autoRead)
            state = DialogState.AUTOREAD;
        else
            state = DialogState.READ;
        this.autoRead = autoRead;
    }
Esempio n. 34
0
        private void _initializeUser(string playername = "")
        {
            Inventory = new Inventory(59);
            Equipment = new Inventory(18);
            SkillBook = new Book(90);
            SpellBook = new Book(90);
            IsAtWorldMap = false;
            Login = new LoginInfo();
            Password = new PasswordInfo();
            Location = new Location();
            Legend = new List<LegendMark>();
            Guild = new GuildMembership();
            LastSaid = String.Empty;
            LastSpoke = 0;
            NumSaidRepeated = 0;
            PortraitData = new byte[0];
            ProfileText = string.Empty;
            DialogState = new DialogState(this);
            UserFlags = new Dictionary<String, String>();
            UserSessionFlags = new Dictionary<String, String>();
            Status = PlayerStatus.Alive;
            Group = null;
            Flags = new Dictionary<string, bool>();
            if (!string.IsNullOrEmpty(playername))
            {
                Name = playername;
            }

        }
Esempio n. 35
0
    public void Show(bool suppressEvents)
    {
        //textObject.fontSize = (int)(Screen.width / fontToScreenWidthRatio);

        if (currentDialog)
        {
            currentDialog.Hide(true);
        }

        currentDialog = this;

        if (!suppressEvents)
        {
            onShow.ForEach(s => s.Fire());
        }

        fullText = prefix + dialogText;
        visibleText = prefix;

        delayTimer = 0.0f;
        letterTimer = 0.0f;
        letterIndex = prefix.Length;

        state = DialogState.Unhiding;
    }
Esempio n. 36
0
 public virtual void Activate(GameTime gameTime)
 {
     fadeStartTime = (float)gameTime.TotalGameTime.TotalMilliseconds;
     state = DialogState.FadingIn;
     selectionChanged = true;
     nagOrigin = Shorewood.fonts[FontTypes.MenuButtonFont].MeasureString(Shorewood.localization[Shorewood.language][IETGames.Shorewood.Localization.GameStrings.PuchaseNag]) / 2;
     nagPosition = new Vector2(bounds.Center.X - nagOrigin.X, bounds.Bottom + 10);
     //Shorewood.inputHandler.AddEvent(Buttons.Y, OnY);
 }
Esempio n. 37
0
    void Update()
    {
        // TODO need to adjust size according to viewport size, if a threshold is exceeded, use
        // a fixed size for the box

        //textObject.fontSize = (int)(Screen.width / fontToScreenWidthRatio);

        delayTimer += Time.deltaTime;

        if (state == DialogState.Hidden)
        {
            // DO NOTHING
        }
        else if (state == DialogState.Unhiding)
        {
            // show and start typing after delay
            if (delayTimer > showDelay)
            {
                state = DialogState.Typing;
            }
        }
        else if (state == DialogState.Typing)
        {
            if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                // Skip typing, fully reveal
                if (skipSound)
                {
                    //audio.PlayOneShot(skipSound, typeVolume);
                    AudioSource3D.PlayClipOmnipresent(typeSound, typeVolume);
                }

                state = DialogState.Showing;
                delayTimer = 0.0f;
            }
            else
            {
                // Reveal letters one by one
                letterTimer += Time.deltaTime;
                if (letterTimer > letterTime)
                {
                    if (letterIndex < fullText.Length)
                    {
                        if (typeSound)
                        {
                            AudioSource3D.PlayClipOmnipresent(typeSound, typeVolume);
                        }
                    }
                    else
                    {
                        // Fully revealed, go to Showing state
                        state = DialogState.Showing;
                        letterIndex--;
                        delayTimer = 0.0f;
                    }

                    letterIndex++;
                    letterTimer = 0;
                }
            }

            visibleText = fullText.Substring(0, letterIndex);
        }
        else if (state == DialogState.Showing)
        {
            visibleText = fullText;

            // Hide if enter hit or if nonzero showtime expires
            if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)
                    || (showTime > 0 && delayTimer > showTime))
            {
                audio.PlayOneShot(skipSound, typeVolume);
                Hide();
            }
        }
    }
Esempio n. 38
0
 public virtual void Deactivate(GameTime gameTime)
 {
     fadeStartTime = (float)gameTime.TotalGameTime.TotalMilliseconds;
     state = DialogState.FadingOut;
 }
Esempio n. 39
0
		void ChangeState (DialogState newState)
		{
			bool hasConfig = comboModel.Active == 0;

			switch (newState) {
			case DialogState.Create:
				btnBack.Visible = false;
				btnConfig.Visible = true;
				btnConfig.Sensitive = isWebService && hasConfig;
				btnOK.Visible = true;
				btnOK.Sensitive = isWebService;
				tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
				tbxReferenceName.Sensitive = isWebService;
				comboModel.Sensitive = true;
				break;

			case DialogState.CreateConfig:
				btnBack.Visible = true;
				btnBack.Sensitive = true;
				btnConfig.Visible = false;
				btnOK.Visible = true;
				btnOK.Sensitive = true;
				tlbNavigate.Visible = false;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;

			case DialogState.Modify:
				btnBack.Visible = false;
				btnConfig.Visible = true;
				btnConfig.Sensitive = isWebService && hasConfig;
				btnOK.Visible = true;
				btnOK.Sensitive = isWebService;
				tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;

			case DialogState.ModifyConfig:
				btnBack.Visible = false;
				btnConfig.Visible = false;
				btnOK.Visible = true;
				btnOK.Sensitive = true;
				tlbNavigate.Visible = false;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;
				
			default:
				throw new InvalidOperationException ();
			}

			if (wcfConfig != null)
				wcfConfig.Update ();

			if (state == newState)
				return;

			if (state != DialogState.Uninitialized)
				frmBrowser.Forall (c => frmBrowser.Remove (c));

			browser = null;
			browserWidget = null;
			docLabel = null;
			wcfConfig = null;

			state = newState;
			
			ScrolledWindow sw;

			switch (state) {
			case DialogState.Create:
			case DialogState.Modify:
				if (WebBrowserService.CanGetWebBrowser) {
					browser = WebBrowserService.GetWebBrowser ();
					browserWidget = (Widget) browser;
					browser.LocationChanged += Browser_LocationChanged;
					browser.NetStart += Browser_StartLoading;
					browser.NetStop += Browser_StopLoading;
					frmBrowser.Add (browserWidget);
					browser.LoadUrl (tbxReferenceURL.Text);
					browserWidget.Show ();
				} else {
					docLabel = new Label ();
					docLabel.Xpad = 6;
					docLabel.Ypad = 6;
					docLabel.Xalign = 0;
					docLabel.Yalign = 0;

					sw = new ScrolledWindow ();
					sw.ShadowType = ShadowType.In;
					sw.AddWithViewport (docLabel);
					sw.ShowAll ();
					frmBrowser.Add (sw);
					UpdateLocation ();
				}
				break;

			case DialogState.ModifyConfig:
			case DialogState.CreateConfig:
				if (!hasConfig)
					return;

				sw = new ScrolledWindow ();
				sw.ShadowType = ShadowType.In;

				wcfConfig = new WCFConfigWidget (wcfOptions);
				sw.AddWithViewport (wcfConfig);
				sw.ShowAll ();
				frmBrowser.Add (sw);
				break;

			default:
				throw new InvalidOperationException ();
			}
		}
Esempio n. 40
0
 private DialogResult STAShowDialog(FileDialog dialog)
 {
     DialogState state = new DialogState();
     state.dialog = dialog;
     System.Threading.Thread t = new System.Threading.Thread(state.ThreadProcShowDialog);
     t.SetApartmentState(System.Threading.ApartmentState.STA);
     t.Start();
     t.Join();
     return state.result;
 }
Esempio n. 41
0
 protected virtual void UpdateFadeIn(GameTime gameTime)
 {
     float scale = MathHelper.SmoothStep(0, 1, ((float)gameTime.TotalGameTime.TotalMilliseconds - fadeStartTime) / fadeDuration);
     MathHelper.Clamp(scale, 0, 1);
     Scale(scale);
     if (scale == 1)
     {
         state = DialogState.Active;
         OnActivated(gameTime);
     }
 }
Esempio n. 42
0
 protected virtual void UpdateFadeOut(GameTime gameTime)
 {
     float scale = MathHelper.SmoothStep(1, 0, ((float)gameTime.TotalGameTime.TotalMilliseconds - fadeStartTime) / fadeDuration);
     MathHelper.Clamp(scale, 0, 1);
     Scale(scale);
     if (scale == 0)
     {
         state = DialogState.Inactive;
         Reset();
         OnDeactivated(gameTime);
     }
 }
        //*************************************************************************
        //  Constructor: CreateSubgraphImagesDialog()
        //
        /// <overloads>
        /// Initializes a new instance of the <see
        /// cref="CreateSubgraphImagesDialog" /> class.
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="CreateSubgraphImagesDialog" /> class with a workbook.
        /// </summary>
        ///
        /// <param name="workbook">
        /// Workbook containing the graph data.
        /// </param>
        ///
        /// <param name="selectedVertexNames">
        /// Collection of zero or more vertex names corresponding to the selected
        /// rows in the vertex worksheet.  Can't be null.
        /// </param>
        ///
        /// <param name="mode">
        /// Indicates the mode in which the dialog is being used.
        /// </param>
        //*************************************************************************
        public CreateSubgraphImagesDialog(
            Microsoft.Office.Interop.Excel.Workbook workbook,
            ICollection<String> selectedVertexNames,
            DialogMode mode
            )
            : this()
        {
            Debug.Assert(workbook != null);
            Debug.Assert(selectedVertexNames != null);

            m_oWorkbook = workbook;
            m_oSelectedVertexNames = selectedVertexNames;
            m_eMode = mode;

            // Instantiate an object that saves and retrieves the user settings for
            // this dialog.  Note that the object automatically saves the settings
            // when the form closes.

            m_oCreateSubgraphImagesDialogUserSettings =
            new CreateSubgraphImagesDialogUserSettings(this);

            m_oSubgraphImageCreator = new SubgraphImageCreator();

            m_oSubgraphImageCreator.ImageCreationProgressChanged +=
            new ProgressChangedEventHandler(
                SubgraphImageCreator_ImageCreationProgressChanged);

            m_oSubgraphImageCreator.ImageCreationCompleted +=
            new RunWorkerCompletedEventHandler(
                SubgraphImageCreator_ImageCreationCompleted);

            m_eState = DialogState.Idle;

            DoDataExchange(false);

            AssertValid();
        }
    StartImageCreation()
    {
        AssertValid();
        Debug.Assert(m_oWorkbook != null);
        Debug.Assert(m_oSelectedVertexNames != null);

        // Read the workbook into a new IGraph.

        IGraph oGraph;

        try
        {
            oGraph = ReadWorkbook(m_oWorkbook);
        }
        catch (Exception oException)
        {
            ErrorUtil.OnException(oException);
            this.State = DialogState.Idle;

            return;
        }

        lblStatus.Text = "Creating subgraph images.";

        ICollection<IVertex> oSelectedVertices = new IVertex[0];

        if (m_oCreateSubgraphImagesDialogUserSettings.SelectedVerticesOnly)
        {
            // Get the vertices corresponding to the selected rows in the
            // vertex worksheet.

            oSelectedVertices = GetSelectedVertices(
                oGraph, m_oSelectedVertexNames);
        }

        m_oSubgraphImageCreator.CreateSubgraphImagesAsync(
            oGraph,
            oSelectedVertices,
            m_oCreateSubgraphImagesDialogUserSettings.Levels,
            m_oCreateSubgraphImagesDialogUserSettings.SaveToFolder,
            m_oCreateSubgraphImagesDialogUserSettings.Folder,
            m_oCreateSubgraphImagesDialogUserSettings.ImageSizePx,
            m_oCreateSubgraphImagesDialogUserSettings.ImageFormat,
            m_oCreateSubgraphImagesDialogUserSettings.InsertThumbnails,
            m_oCreateSubgraphImagesDialogUserSettings.ThumbnailSizePx,
            m_oCreateSubgraphImagesDialogUserSettings.SelectedVerticesOnly,
            m_oCreateSubgraphImagesDialogUserSettings.SelectVertex,
            m_oCreateSubgraphImagesDialogUserSettings.SelectIncidentEdges,
            new GeneralUserSettings(),
            new LayoutUserSettings()
            );
    }
Esempio n. 45
0
    public void Hide(bool suppressEvents)
    {
        currentDialog = null;

        if (!suppressEvents)
        {
            onHide.ForEach(s => s.Fire());
        }

        state = DialogState.Hidden;

        if (CharacterPortrait != null)
            CharacterPortrait.enabled = false;

    }
    private void Scroll()
    {
        dialog.position = Vector3.Lerp(dialog.position, toScroll, Time.deltaTime * 10);

        if (dialog.position.y + 1 >= toScroll.y)
        {
            dialog.position = toScroll;

            if (autoRead)
                state = DialogState.AUTOREAD;
            else
                state = DialogState.READ;

            ++numberOfScroll;
        }
    }
Esempio n. 47
0
 public virtual void Reset()
 {
     state = DialogState.Inactive;
     dialogResult = DialogResult.Nothing;
     bounceExpanding = true;
     selectionChanged = true;
     selectedScale = 1;
     SelectedOption = 0;
 }
    OnImageCreationCompleted
    (
        RunWorkerCompletedEventArgs e
    )
    {
        AssertValid();
        Debug.Assert(m_oWorkbook != null);
        Debug.Assert(m_oSelectedVertexNames != null);

        if (e.Cancelled)
        {
            this.State = DialogState.Idle;

            lblStatus.Text = "Image creation stopped.";
        }
        else if (e.Error != null)
        {
            this.State = DialogState.Idle;

            Exception oException = e.Error;

            if (oException is System.IO.IOException)
            {
                lblStatus.Text = "Image creation error.";

                this.ShowWarning(oException.Message);
            }
            else
            {
                ErrorUtil.OnException(oException);
            }
        }
        else
        {
            // Success.  Were temporary images created that need to be inserted
            // into the vertex worksheet?

            Debug.Assert(e.Result is TemporaryImages);

            TemporaryImages oTemporaryImages = (TemporaryImages)e.Result;

            if (oTemporaryImages.Folder != null)
            {
                // Yes.  Insert them, then delete the temporary images.

                this.State = DialogState.PopulatingImageColumn;

                String sLastStatusFromSubgraphImageCreator = lblStatus.Text;

                lblStatus.Text =
                    "Inserting subgraph thumbnails into the worksheet.  Please"
                    + " wait...";

                TableImagePopulator.PopulateColumnWithImages(m_oWorkbook,
                    WorksheetNames.Vertices, TableNames.Vertices,
                    VertexTableColumnNames.SubgraphImage,
                    VertexTableColumnNames.VertexName, oTemporaryImages
                    );

                lblStatus.Text = sLastStatusFromSubgraphImageCreator;
            }

            this.State = DialogState.Idle;

            if (m_eMode == DialogMode.Automate)
            {
                this.Close();
            }
        }
    }
Esempio n. 49
0
        private void _initializeUser(string playername = "")
        {
            Inventory = new Inventory(59);
            Equipment = new Inventory(18);
            //SkillBook = new Skill[90];
            //SpellBook = new Spell[90];
            IsAtWorldMap = false;
            Title = String.Empty;
            Guild = String.Empty;
            GuildRank = String.Empty;
            LegendMarks = null;
            LastSaid = String.Empty;
            LastSpoke = 0;
            NumSaidRepeated = 0;
            PortraitData = new byte[0];
            ProfileText = string.Empty;
            DialogState = new DialogState(this);
            UserFlags = new Dictionary<String, String>();
            UserSessionFlags = new Dictionary<String, String>();
            Status = PlayerStatus.Alive;

            if (!string.IsNullOrEmpty(playername))
            {
                Name = playername;
                LoadDataFromEntityFramework();
            }
        }
    private void CheckSpace()
    {
        string nextWord = text.Substring(indexText + 2);

        int length = nextWord.IndexOf(' ') + 1;

        if (indexText + length + 2 >= 118 + (62 * numberOfScroll))
        {
            builder[indexText + 1] = '\n';
            text = builder.ToString();

            if (state != DialogState.AUTOREAD)
                state = DialogState.WAIT;
            else
                state = DialogState.SCROLL;
            toScroll = new Vector3(dialog.position.x,
                                   dialog.position.y + 50,
                                   dialog.position.z);
        }

        dialogText.text += text[indexText + 1];
        ++indexText;
    }
    btnCreate_Click
    (
        object sender,
        EventArgs e
    )
    {
        AssertValid();

        switch (this.State)
        {
            case DialogState.Idle:

                if (!m_oSubgraphImageCreator.IsBusy)
                {
                    if ( DoDataExchange(true) )
                    {
                        if (m_eMode == DialogMode.EditOnly)
                        {
                            this.Close();
                            return;
                        }
                        else
                        {
                            this.State = DialogState.CreatingSubgraphImages;
                            StartImageCreation();
                        }
                    }
                }

                break;

            case DialogState.CreatingSubgraphImages:

                if (m_oSubgraphImageCreator.IsBusy)
                {
                    // Request to cancel image creation.  When the request is
                    // completed, SubgraphImageCreator_ImageCreationCompleted()
                    // will be called.

                    m_oSubgraphImageCreator.CancelAsync();
                }

                break;

            case DialogState.PopulatingImageColumn:

                // (Do nothing.)

                break;

            default:

                Debug.Assert(false);
                break;
        }
    }