Exemple #1
0
 public void EnqueueDialog(DialogBase db, TaskGiver giver = null)
 {
     if (inDialog)
     {
         return;
     }
     buffer   = true;
     inDialog = true;
     PlayerStatus.Instance.IsForzen = true;
     GameManager.Instance.playerGO.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
     //读取说话人并触发说话事件
     if (giver != null)
     {
         tg = giver;
         tg.OnTalkBegin();
     }
     //缓冲器
     StartCoroutine(BufferTimer());
     //判断是否携带选项
     OptionsParser(db);
     //展现对话panel
     UIMgr.Instance.ShowPanel <BasePanel>("DialogPanel", E_UI_Layer.top, (obj) => {
         dialogBox = obj.GetComponent <DialogPanel>();
     });
     //清空队列并逐句读取
     dialogInfo.Clear();
     foreach (DialogBase.Info info in db.dialogInfo)
     {
         dialogInfo.Enqueue(info);
     }
     //读取完成后输出第一行
     Invoke("DequeueDialog", 0.1f);
 }
        private void buttonFavouritesDelete_Click(object sender, RoutedEventArgs e)
        {
            FavouriteBase item = treeView.SelectedItem as FavouriteBase;

            if (item != null)
            {
                FavouriteFolder parent = FindParent(_rootFolder, item);

                if (parent != null)
                {
                    string res = item is FavouriteFolder ? "QUESTIONDELETEFAVOURITEFOLDER" : "QUESTIONDELETEFAVOURITE";

                    DialogPanel.ShowQuestionBox(CultureHelper.GetString(Properties.Resources.ResourceManager, res),
                                                DialogButtons.Yes | DialogButtons.No,
                                                delegate(DialogResult dialogResult)
                    {
                        if (dialogResult == DialogResult.Yes)
                        {
                            parent.Children.Remove(item);
                        }
                    }
                                                );
                }
            }
            UpdateButtonStates();
        }
Exemple #3
0
    private void HandleAuthenticated(bool success)

    {
        Debug.Log("*** HandleAuthenticated: success = " + success);

        if (success)
        {
            if (_callback != null)
            {
                _callback.Invoke(Social.localUser.id.Replace(':', '_'));
            }


            Debug.Log("*** HandleAuthenticated: Social.localUser.id = " + Social.localUser.id);
            //Social.localUser.LoadFriends(HandleFriendsLoaded);

            //Social.LoadAchievements(HandleAchievementsLoaded);

            //Social.LoadAchievementDescriptions(HandleAchievementDescriptionsLoaded);
        }
        else
        {
            DialogPanel.ShowDialogMessage("Failed to Authenticate player.", delegate {
                PayMgr.Instance.CallIosSetting();
            });
        }
    }
Exemple #4
0
    void AfterConversation(DialogPanel panel)
    {
        // Unlock the group
        UnlockGroupAndNews(false);

        // Unlock other things
        if (changeHusbandIncome == true)
        {
            parentPanel.HusbandsIncome = husbandIncomeCents;
        }
        if (increaseAccount == true)
        {
            parentPanel.CurrentCurrencyCents += increaseCents;
        }

        parentPanel.Queue.ResetTime();

        if (resetData == true)
        {
            // Reload this scene
            Singleton.Get <TimeManager>().PauseFor(3f);
            Singleton.Get <GameSettings>().ClearSettings();
            Singleton.Get <SceneManager>().ReloadCurrentScene();
        }
    }
 private void FindDialogPanel()
 {
     dialogCanvas = FindObjectOfType <DialogCanvas>();
     if (dialogCanvas != null)
     {
         dialog = dialogCanvas.GetComponentInChildren <DialogPanel>(true);
     }
 }
Exemple #6
0
    public void InitiateDialog(DialogPanel dialog_panel)
    {
        CurrentStatement = (FinalStatement == null) ? OpeningStatement : FinalStatement;
        DisplayCurrent();

        // We do not refresh the dialog sequence after closing, so the last current will be displayed again.
        // This may or may not be desirable.
    }
    public BoardDialogInputState(CutScene cs, BoardManager bm) : base(bm)
    {
        this.cs = cs;

        dialogpanel = bm.ui.dialogPanel;
        choicePanel = bm.ui.dialogChoice;

        GetNextNode();
    }
Exemple #8
0
    private ApiYummlyRecipes(string ApiKey)
    {
        if (ApiKey != "" && ApiKey != null)
        {
            this.ApiKey = ApiKey;
        }

        Debug.LogError("<YummlyRecipes> Api created");
        dialogPanel = DialogPanel.Instance();
    }
    private ApiMicrosoftAzureOcr(string ApiKey)
    {
        if (ApiKey != "" && ApiKey != null)
        {
            this.ApiKey = ApiKey;
        }

        this.OcrResult = new OcrResult("", new UnityEngine.Rect(0, 0, 0, 0), OcrService.MICROSOFTAZUREOCR);
        dialogPanel    = DialogPanel.Instance();
    }
    public static DialogPanel Instance()
    {
        if (!dialogPanel)
        {
            dialogPanel = FindObjectOfType(typeof(DialogPanel)) as DialogPanel;
            if (!dialogPanel)
                Debug.LogError("There needs to be one active ModalPanel script on a GameObject in your scene.");
        }

        return dialogPanel;
    }
Exemple #11
0
 public static DialogPanel Instance()
 {
     if (!dialog)
     {
         dialog = FindObjectOfType <DialogPanel>() as DialogPanel;
         if (!dialog)
         {
             Debug.LogError("There must be one active DialogPanel script on a GameObject in the scene.");
         }
     }
     return(dialog);
 }
Exemple #12
0
    IEnumerator BossWaitForEndOfDialog(DialogPanel dp)
    {
        yield return(new WaitUntil(() => !dp.gameObject.activeSelf));

        GetComponent <EnemyAttacker>().enabled = true;
        GetComponent <FieldOfView>().enabled   = true;
        GetComponent <HealthSystem>().enabled  = true;
        GetComponent <EnemyMovement>().enabled = true;
        GetComponent <Assets.Scripts.Actors.Enemy.EnemyAIBrain>().enabled = true;

        Destroy(this, 0);
    }
    public override void Interact()
    {
        base.Interact();
        if (check)
        {
            return;
        }
        base.Interact();
        check = true;
        StartCoroutine("reset");

        if (this.GetComponent <NPCItem>() != null)
        {
            this.GetComponent <NPCItem>().setNPCItem(this.GetComponent <NPCItem>().ntype);
            Debug.Log("set item");
        }

        Debug.Log("interact");
        if (dialogPanel != null)
        {
            dialogPanel.SetActive(true);
            DialogArray da = GetComponent <DialogArray> ();
            DialogPanel dp = dialogPanel.GetComponentInChildren <DialogPanel> ();
            if (dp != null)
            {
                dp.UpdateDialog(da.conversations);
            }
        }



        for (int i = 0; i < conditionCollections.Length; i++)
        {
            if (conditionCollections[i].CheckAndReact())
            {
                Debug.Log("not default");
                //return;
                conditionCollections[i].complete = true;
                QuestListUpdate();
                return;
            }
            //conditionCollections[i].CheckAndReact ();
        }

        QuestListUpdate();
        Debug.Log("default");
        if (defaultReactionCollection != null)
        {
            defaultReactionCollection.React();
        }
        //manager.content = questList.Change();
    }
Exemple #14
0
 public void StartDialog(DialogData dlgData, int index = 0)
 {
     isShowing    = true;
     data         = dlgData;
     currentLine  = index;
     targetString = data.contents[index].dialogText;
     ui           = GameManager.Singleton.uiMgr.GetPanel <DialogPanel>();
     if (ui == null)
     {
         ui = GameManager.Singleton.uiMgr.ShowPanel <DialogPanel>();
     }
     state = State.typing;
 }
Exemple #15
0
    public static DialogPanel Instance()
    {
        if (!dialogPanel)
        {
            dialogPanel = FindObjectOfType(typeof(DialogPanel)) as DialogPanel;
            if (!dialogPanel)
            {
                Debug.LogError("There needs to be one active ModalPanel script on a GameObject in your scene.");
            }
        }

        return(dialogPanel);
    }
Exemple #16
0
    // Start is called before the first frame update
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this);
        }
        else if (instance == null)
        {
            instance = this;
        }

        this.gameObject.SetActive(false);
    }
    public void setDialog(int textIdx)
    {
        if (dialogPanel == null)
        {
            dialogPanel = UIMgr.Open("UIPanel/DialogPanel").GetComponent <DialogPanel> ();
        }

        if (dialogPanel.gameObject.activeInHierarchy == false)
        {
            dialogPanel.gameObject.SetActive(true);
        }

        dialogPanel.setDialog(textIdx);
    }
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
     Text   = GetComponentInChildren <Text>();
     _image = GetComponent <Image>();
     Active(false);
 }
Exemple #19
0
 private void buttonThumbnailCacheEmpty_Click(object sender, RoutedEventArgs e)
 {
     DialogPanel.ShowQuestionBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "THUMBNAILEMPTYQUESTION"), DialogButtons.Yes | DialogButtons.No,
                                 delegate(DialogResult dialogResult)
     {
         if (dialogResult == DialogResult.Yes)
         {
             if (ThumbnailCacheClear != null)
             {
                 ThumbnailCacheClear();
             }
         }
     });
 }
Exemple #20
0
 protected virtual void Start()
 {
     dialogPanel = FindObjectOfType <DialogPanel>();
     file        = Application.dataPath + "/StreamingAssets/" + textAssetName + ".csv";
     if (System.IO.File.Exists(file))
     {
         WriteAllBoxes();
         SetTriggers();
     }
     else
     {
         Debug.LogError("File:" + file + "do not found!");
     }
 }
    public static DialogPanel CreateDialog(string content, string ok, string dismiss)
    {
        if (m_singleton == null)
        {
            DialogPanel dialog = ((GameObject)GameObject.Instantiate(Resources.Load("Prefabs/DialogPanel"))).GetComponent<DialogPanel>();
            GameObject canvas = GameObject.Find("OverlayCanvas");
            dialog.transform.SetParent(canvas.transform, false);

            dialog.m_content = content;
            dialog.m_dismiss = dismiss;
            dialog.m_ok = ok;
            m_singleton = dialog;
            dialog.CreateDialog();
        }

        return m_singleton;
    }
Exemple #22
0
 private void buttonHistoryClear_Click(object sender, RoutedEventArgs e)
 {
     DialogPanel.ShowQuestionBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "QUESTIONCLEARHISTORY"),
                                 DialogButtons.Yes | DialogButtons.No,
                                 delegate(DialogResult dialogResult)
     {
         if (dialogResult == DialogResult.Yes)
         {
             if (HistoryClearItems != null)
             {
                 listItems.Items.Clear();
                 HistoryClearItems();
             }
             UpdateButtonStates();
         }
     });
 }
Exemple #23
0
    /// <summary>
    /// called when the application is started
    /// </summary>
    void Start()
    {
        // link managers
        apiManager        = ApiManager.Instance;
        screenshotManager = ScreenshotManager.Instance;
        visualTextManager = VisualTextManager.Instance;
        gesturesManager   = GesturesManager.Instance;


        // Link IconObjects, deactivate animation
        loadingIcon = Instantiate(loadingIcon);
        loadingIcon.SetActive(false);
        cursor     = GameObject.Find("CursorVisual");
        cursorSize = cursor.transform.localScale;


        // subscribe to events
        screenshotManager.ScreenshotTaken         += OnScreenshotTaken;
        apiManager.ImageAnalysed                  += onImageAnalysed;
        gesturesManager.Tapped                    += onTapped;
        gesturesManager.DoubleTapped              += onDoubleTapped;
        visualTextManager.VisualizedTextFocused   += OnVisualizedTextFocused;
        visualTextManager.VisualizedTextUnfocused += OnVisualizedTextUnfocused;

        analysingScreenshot = false;
        timeCounter         = 0;
        timeInterval        = 1;

        currentRequestCause = RequestCause.REGULAR;
        nextRequestCause    = RequestCause.REGULAR;

        screenshotsTakeable = true;


        cameraPositionResultTmp = new CameraPositionResult();

        currentId = 0;

        visualizedTextFocused    = false;
        focusedVisualizedTextTmp = "";

        dialogPanel = DialogPanel.Instance();
    }
Exemple #24
0
        public static bool Prefix(
            DialogPanel ___optionsPanel,
            KButton ___optionsButton,
            Schedule schedule)
        {
            var button = ___optionsPanel.GetComponent <HierarchyReferences>().GetReference <KButton>("ResetButton");

            var panel = DefaultControls.CreatePanel(new DefaultControls.Resources());

            panel.name = "ButtonsHolder";
            panel.GetComponent <Image>().color = Color.clear;
            if (!SetParentAndLayer(panel, ___optionsButton.gameObject.transform.parent.gameObject))
            {
                SetLayerRecursively(panel, LayerMask.NameToLayer("UI"));
            }

            var orAddComponent = panel.FindOrAddComponent <GridLayoutGroup>();

            orAddComponent.cellSize       = new Vector2(24, 24);
            orAddComponent.spacing        = new Vector2(5, 0);
            orAddComponent.childAlignment = TextAnchor.UpperCenter;

            _buttonsHolderPanel = panel;

            var leftButton = Util.KInstantiateUI <KButton>(button.gameObject, _buttonsHolderPanel.gameObject, true);

            leftButton.name = "LeftShiftButton";
            leftButton.GetComponentInChildren <LocText>().text = "<";
            leftButton.GetComponentInChildren <ToolTip>().ClearMultiStringTooltip();
            leftButton.onClick += schedule.LeftShift;


            var rightButton = Util.KInstantiateUI <KButton>(button.gameObject, _buttonsHolderPanel.gameObject, true);

            rightButton.name = "RightShiftButton";
            rightButton.GetComponentInChildren <LocText>().text = ">";

            rightButton.GetComponentInChildren <ToolTip>().ClearMultiStringTooltip();
            rightButton.onClick += schedule.RightShift;

            return(true);
        }
Exemple #25
0
 private void buttonHistoryDelete_Click(object sender, RoutedEventArgs e)
 {
     if (listItems.SelectedItem != null)
     {
         DialogPanel.ShowQuestionBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "QUESTIONDELETEHISTORY"),
                                     DialogButtons.Yes | DialogButtons.No,
                                     delegate(DialogResult dialogResult)
         {
             if (dialogResult == DialogResult.Yes)
             {
                 if (HistoryDeleteItem != null)
                 {
                     HistoryDeleteItem(listItems.SelectedItem as SearchDescription);
                 }
                 listItems.Items.Remove(listItems.SelectedItem);
                 UpdateButtonStates();
             }
         });
     }
 }
        private void buttonFavouritesRename_Click(object sender, RoutedEventArgs e)
        {
            FavouriteBase item = treeView.SelectedItem as FavouriteBase;

            if (item != null)
            {
                Dialogs.FavouriteName dialog = new FavouriteName();

                dialog.ItemName = item.Name;

                DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "PROPERTIES", dialog, "textFavouriteName", DialogButtons.Ok | DialogButtons.Cancel,
                                       delegate(DialogResult dialogResult)
                {
                    if (dialogResult == DialogResult.Ok)
                    {
                        item.Name = dialog.ItemName;
                    }
                }
                                       );
            }
        }
Exemple #27
0
 public static void BattleStart(Action <List <BattlePlayerInfo> > callback)
 {
     if (Temp.Online)
     {
         GameProtocol.BattleStart.Send(res => {
             if (res.Result == ReturnCode.OK)
             {
                 var players = new List <BattlePlayerInfo> ();
                 for (int i = 0; i < 9; i++)
                 {
                     players.Add(new BattlePlayerInfo()
                     {
                         NickName = BattleScene.Instance.GetRandomNickName(),
                         Uid      = Guid.NewGuid().ToString(),
                         Level    = RandomUtility.Random0ToMax(10)
                     });
                 }
                 callback(players);
             }
             else
             {
                 DialogPanel.ShowDialogMessage(res.Result.Message);
             }
         });
     }
     else
     {
         var players = new List <BattlePlayerInfo>();
         for (int i = 0; i < 9; i++)
         {
             players.Add(new BattlePlayerInfo()
             {
                 NickName = BattleScene.Instance.GetRandomNickName(),
                 Uid      = Guid.NewGuid().ToString(),
                 Level    = RandomUtility.Random0ToMax(10)
             });
         }
         callback(players);
     }
 }
 private void buttonExit_Click(object sender, RoutedEventArgs e)
 {
     if (ExitAnnotation != null)
     {
         if (_changeCount > 0)
         {
             DialogPanel.ShowQuestionBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "CHANGESWILLBEDISCARDED") +
                                         CultureHelper.GetString(Properties.Resources.ResourceManager, "CONTINUEANYWAY")
                                         , DialogButtons.Yes | DialogButtons.No,
                                         delegate(DialogResult dialogResult)
             {
                 if (dialogResult == DialogResult.Yes)
                 {
                     ExitAnnotation();
                 }
             }
                                         );
         }
         else
         {
             ExitAnnotation();
         }
     }
 }
Exemple #29
0
 void Awake()
 {
     modalPanel = DialogPanel.Instance();
     StartCoroutine(modalPanel.StartDialog(dialogText));
 }
    public void ParseResponseData(object response)
    {
#if (!UNITY_EDITOR)
        if ((string)response == "" || response == null)
        {
            // Debug.LogError("<AzureOCR> No Text recognized");
        }
        else
        {
            var responseTemp = JsonConvert.DeserializeObject <MicrosoftAzureResult.RootObject>((string)response);

            // Find bounding box coords which surround the entire recognized text block
            float xMin, yMin, xMax, yMax;
            xMin = yMin = xMax = yMax = 0;
            float  xMinTemp, yMinTemp, xMaxTemp, yMaxTemp;
            string text = "";

            for (int i = 0; i < responseTemp.regions.Count; i++)
            {
                // convert string of bounding box numbers to int array
                // pattern: boundingBox = [x, y, width, height]
                string[] tmp             = responseTemp.regions[i].boundingBox.Split(',');
                int[]    boundingBoxTemp = tmp.Select(s => Int32.Parse(s)).ToArray();

                xMinTemp = boundingBoxTemp[0];
                yMinTemp = boundingBoxTemp[1];
                xMaxTemp = boundingBoxTemp[0] + boundingBoxTemp[2];
                yMaxTemp = boundingBoxTemp[1] + boundingBoxTemp[3];

                if (i == 0)
                {
                    xMin = xMinTemp;
                    xMax = xMaxTemp;
                    yMin = yMinTemp;
                    yMax = yMaxTemp;
                }
                else
                {
                    if (xMinTemp < xMin)
                    {
                        xMin = xMinTemp;
                    }
                    if (xMaxTemp > xMax)
                    {
                        xMax = xMaxTemp;
                    }
                    if (yMinTemp < yMin)
                    {
                        yMin = yMinTemp;
                    }
                    if (yMaxTemp > yMax)
                    {
                        yMax = yMaxTemp;
                    }
                }

                for (int j = 0; j < responseTemp.regions[i].lines.Count; j++)
                {
                    for (int k = 0; k < responseTemp.regions[i].lines[j].words.Count; k++)
                    {
                        text = text + " " + responseTemp.regions[i].lines[j].words[k].text;
                    }
                }
            }

            DialogPanel dialogPanelInstance = DialogPanel.Instance();
            dialogPanelInstance.enqueueNotification("Text wurde erkannt: " + OcrResult.Text);
            this.OcrResult = new OcrResult(text, new UnityEngine.Rect(xMin, yMin, (xMax - xMin), (yMax - yMin)), OcrService.MICROSOFTAZUREOCR);
        }
#endif
    }
Exemple #31
0
 private void OnShowUserDialogCommandExecuted()
 {
     DialogPanel.Show(false);
 }
Exemple #32
0
    private void DrawMenu(DialogPanel panel)
    {
        CurrentPanel = panel;
        panel.panel.SetActive(true);

        //als dit de eerste text menu van de reeks is
        if (LastEvent == null)
        {
            if (panel.panelType == PanelType.Narrative)
            {
                Vector3 oldPos = Vector3.zero + CurrentPanel.panel.transform.position;

                CurrentPanel.panel.transform.position = oldPos + Vector3.down * 250;
                CurrentPanel.panel.transform.DOMove(oldPos, .3f);
            }
        }

        panel.HideAllButtons();

        if (panel.title != null)
        {
            panel.title.text = CurrentEvent.title ?? LastEvent?.title ?? "";
        }

        if (CurrentEvent.TextPrintInterval > 0)
        {
            TextPrinter                    = new DialogPrinter(CurrentEvent.description, CurrentEvent.TextPrintInterval, this);
            panel.Description.text         = "";
            TextPrinter.OnTextUpdate      += UpdateDescription;
            TextPrinter.OnPrinterFinished += AssignOptions;
            TextPrinter.OnPrinterFinished += UpdateSecodnDescription;
        }
        else
        {
            panel.Description.text = CurrentEvent.description;
            AssignOptions();
        }

        if (panel.panelType == PanelType.Narrative)
        {
            if (panel.image != null)
            {
                if (CurrentEvent.image != null)
                {
                    panel.image.gameObject.SetActive(true);
                    panel.image.sprite = CurrentEvent.image ?? LastEvent?.image;
                }
                else
                {
                    panel.image.gameObject.SetActive(false);
                }
            }
        }
        else if (panel.panelType == PanelType.CutScene)
        {
            if (panel.image != null)
            {
                if (CurrentEvent.FadeOutTime != 0)
                {
                    Debug.Log("test");
                    panel.image.sprite = CurrentEvent.image;
                    panel.image.color  = new Color(1, 1, 1, 1);
                    panel.image.DOKill(false);
                    panel.image.DOColor(new Color(1, 1, 1, 0), CurrentEvent.FadeOutTime);
                }
                else if (CurrentEvent.FadeInTime != 0)
                {
                    panel.image.sprite = CurrentEvent.image;
                    panel.image.color  = new Color(1, 1, 1, 0);
                    panel.image.DOKill(false);
                    panel.image.DOColor(new Color(1, 1, 1, 1), CurrentEvent.FadeInTime);
                }
                else
                {
                    panel.image.sprite = CurrentEvent.image;
                    panel.image.color  = new Color(1, 1, 1, 1);
                }
            }
        }

        if (panel.SecondDescription != null)
        {
            panel.SecondDescription.text = TextPrinter != null && TextPrinter.IsPrinting() ? "..." : "PRESS TO CONTINUE >";

            panel.SecondDescription.gameObject.SetActive(true);
        }
    }
 void Awake()
 {
     modalPanel = DialogPanel.Instance();
     StartCoroutine(modalPanel.StartDialog(dialogText));
 }