Esempio n. 1
0
 public static void ShowDialogText(DialogFormat dialog)
 {
     m_DialosCanvas.gameObject.SetActive(true);
     m_DialosCanvas.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, 0);
     m_DialosCanvas.Find("Panel").Find("Txt_Speaker").GetComponent <Text>().text = dialog.DialogSpeaker.ToString();
     m_DialosCanvas.Find("Panel").Find("Txt_Content").GetComponent <Text>().text = dialog.DialogContent;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the Dialog class.
 /// </summary>
 /// <param name="message">Message to displayed in the dialog.</param>
 /// <param name="format">Determines what type of dialog should be displayed.  ie: DialogFormat.Warning</param>
 /// <param name="buttons">List of DialogButtons that should be available in the Dialog.</param>
 public Dialog(string message, DialogFormat format, params DialogButton[] buttons)
 {
     //TODO: (erikpo) Instead of just passing message, pass something like "LocalizedString" or something that can pass along information so the message can be localized
     this.Message = message;
     this.Format  = format;
     this.Buttons = buttons != null && buttons.Length > 0 ? buttons : DialogButton.Default;
 }
        private void Update()
        {
            if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Play)
            {
                if (PlayerInfo.GetData == true)
                {
                    GlobalValue.ChangeGamePhare(ENUM_GamePhase.Settlement);
                    PlayerInfo.RemoveTaskList("Find Data");
                }


                m_InputAxis = GlobalValue.GetInputAxis();
                m_Rigid2D.MovePosition(this.transform.position + m_InputAxis * m_Speed * Time.deltaTime);
                if (m_InputAxis != Vector3.zero)
                {
                    m_PlayerAni.SetBool("Run", true);
                }
                else
                {
                    m_PlayerAni.SetBool("Run", false);
                    this.transform.rotation = Quaternion.Euler(0, 0, 0);
                }

                //玩家移动的时候左右旋转
                if (m_InputAxis.x < 0)
                {
                    this.transform.rotation      = Quaternion.Euler(0, 180, 0);
                    m_CanvasPlayer.localRotation = Quaternion.Euler(0, 180, 0);
                }
                else
                {
                    this.transform.rotation      = Quaternion.Euler(0, 0, 0);
                    m_CanvasPlayer.localRotation = Quaternion.Euler(0, 0, 0);
                }
            }
            else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Introduce)
            {
                if (Input.anyKeyDown)
                {
                    UITool.HideNormalPanel();
                    DialogFormat dialogData = DialogData.GetNextDialogData(ENUM_DialogType.Introduce_Start);
                    if (dialogData == null)
                    {
                        GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play);
                        UITool.HideDialogText();
                        TaskFormat task = new TaskFormat();
                        task.TaskName        = "Find Data";
                        task.TaskDescription = "Map Left Up!";
                        PlayerInfo.AddTaskList(task);
                    }
                    else
                    {
                        UITool.ShowDialogText(dialogData);
                    }
                }
            }
            else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Talking)
            {
                m_InputAxis = Vector2.zero;
            }
            else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Settlement)
            {
                //最终结算。
                GameObject.Find("Canvas").transform.Find("Panel_Settlement").gameObject.SetActive(true);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Downloads the dialog by the dialog ID into the provided filename.
        /// </summary>
        /// <param name="dialogId">The ID of the dialog to download.</param>
        /// <param name="dialogFileName">The filename to download the dialog into.</param>
        /// <param name="callback">The callback to invoke on failure or success.</param>
        /// <param name="format">The format to download.</param>
        /// <returns>Returns true if request is sent.</returns>
        public bool DownloadDialog(string dialogId, string dialogFileName, OnDialogCallback callback, DialogFormat format = DialogFormat.XML)
        {
            if (string.IsNullOrEmpty(dialogId))
            {
                throw new ArgumentNullException("dialogId");
            }
            if (string.IsNullOrEmpty(dialogFileName))
            {
                throw new ArgumentNullException("dialogFileName");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v1/dialogs/" + dialogId);

            if (connector == null)
            {
                return(false);
            }

            DownloadDialogReq req = new DownloadDialogReq();

            req.DialogFileName = dialogFileName;
            req.Callback       = callback;
            req.OnResponse     = OnDownloadDialogResp;
            if (format == DialogFormat.XML)
            {
                req.Headers["Accept"] = "application/wds+xml";
            }
            else if (format == DialogFormat.JSON)
            {
                req.Headers["Accept"] = "application/wds+json";
            }
            else
            {
                req.Headers["Accept"] = "application/octet-stream";
            }

            return(connector.Send(req));
        }
Esempio n. 5
0
 //TODO: (erikpo) Instead of just passing message, pass something like "LocalizedString" or something that can pass along information so the message can be localized
 public Dialog(string message, DialogFormat format, params DialogButton[] buttons)
 {
     Message = message;
     Format  = format;
     Buttons = buttons != null && buttons.Length > 0 ? buttons : DialogButton.Default;
 }
Esempio n. 6
0
        private void JudgeInStay()
        {
            Debug.Log(111);
            switch (m_Speaker)
            {
            case ENUM_Speaker.Scientist_A:
                if (Input.GetKeyDown(KeyCode.F))
                {
                    if (PlayerInfo.TalkToNpcA == false)
                    {
                        DialogFormat dialog = DialogData.GetNextDialogData(ENUM_DialogType.PlayerTrigger_A);
                        if (dialog != null)
                        {
                            //显示对话内容
                            UITool.ShowDialogText(dialog);
                            //更改游戏状态为Talking
                            GlobalValue.ChangeGamePhare(ENUM_GamePhase.Talking);
                        }
                        else
                        {
                            UITool.HideDialogText();
                            //添加任务
                            TaskFormat task = new TaskFormat();
                            task.TaskName        = "Find Food";
                            task.TaskDescription = "Map Right UP And Right Middle";
                            PlayerInfo.AddTaskList(task);
                            //更新玩家数据
                            PlayerInfo.TalkToNpcA = true;
                            //更改游戏状态为Play
                            GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play);
                            //告诉你食物的位置
                            UITool.ShowFoodInMap();
                        }
                    }
                    else if (PlayerInfo.MissionDoneA == false)
                    {
                        if (PlayerInfo.Food > 0)
                        {
                            --PlayerInfo.Food;
                            //任务奖励,告诉你注射剂的位置
                            UITool.ShowIntectionInMap();
                            PlayerInfo.MissionDoneA = true;
                            //取消任务
                            PlayerInfo.RemoveTaskList("Find Food");
                        }
                        else
                        {
                            UITool.CreateGossipUICustom("I need find food!");
                        }
                    }
                    else
                    {
                        UITool.CreateGossipUICustom("There is no task here!");
                    }
                }
                break;

            case ENUM_Speaker.Scientist_B:
                if (Input.GetKeyDown(KeyCode.F))
                {
                    if (PlayerInfo.TalkToNpcB == false)
                    {
                        DialogFormat dialog = DialogData.GetNextDialogData(ENUM_DialogType.PlayerTrigger_B);
                        if (dialog != null)
                        {
                            //显示对话内容
                            UITool.ShowDialogText(dialog);
                            GlobalValue.ChangeGamePhare(ENUM_GamePhase.Talking);
                        }
                        else
                        {
                            UITool.HideDialogText();
                            //添加任务
                            TaskFormat task = new TaskFormat();
                            task.TaskName        = "Find Food2";
                            task.TaskDescription = "Map Right";
                            PlayerInfo.AddTaskList(task);
                            //更新玩家数据
                            PlayerInfo.TalkToNpcB = true;
                            GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play);
                        }
                    }
                    else if (PlayerInfo.MissionDoneB == false)
                    {
                        if (PlayerInfo.Food > 0)
                        {
                            --PlayerInfo.Food;
                            //任务奖励,拥有上锁的门的钥匙
                            PlayerInfo.DoorA        = true;
                            PlayerInfo.MissionDoneB = true;
                            //取消任务
                            PlayerInfo.RemoveTaskList("Find Food2");
                        }
                        else
                        {
                            UITool.CreateGossipUICustom("I need find food!");
                        }
                    }
                    else
                    {
                        UITool.CreateGossipUICustom("There is no task here!");
                    }
                }
                break;

            default:
                break;
            }
        }
        public static DialogResult Dialog(this ControllerBase controller, string message, DialogFormat format, params DialogButton[] buttons)
        {
            controller.ViewData.Model = new OxiteViewModelItem <Dialog>(new Dialog(message, format, buttons));

            return(new DialogResult());
        }