Ejemplo n.º 1
0
    IEnumerator SetText(Queue <DialogInfo> dialogList, Text text)
    {
        DialogInfo dialogInfo = dialogList.Dequeue();

        SetHeadImage(dialogInfo);
        OnPlayingBegin(text, dialogInfo);

        content = dialogInfo.dialogContent;

        if (OpenAudioClipMatchingLength)
        {
            coroutineTime = dialogInfo.dialogAudioClip.length;//让对话和语言匹配
        }


        for (int i = 0; i < content.Length; i++)
        {
            if (i >= content.Length)
            {
                break;
            }
            text.text += content.Substring(i, 1);
            //print("time = " +  coroutineTime / (float)content.Length);
            yield return(new WaitForSeconds(coroutineTime / (float)content.Length));
        }

        OnPlayingEnd();
    }
Ejemplo n.º 2
0
    private void LoadAsset()
    {
        List <DialogInfo> dialogInfos = GetAllAsset();

        DialogInfo[] tempList = new DialogInfo[dialogInfos.Count];
        for (int i = 0; i < dialogInfos.Count; i++)
        {
            if (dialogInfos[i] == null)
            {
                continue;
            }
            if (dialogInfos[i].isEnable)
            {
                tempList[dialogInfos[i].dialogIndex] = dialogInfos[i];//排序,用对话的顺序作为数组的索引
            }
        }

        foreach (var item in tempList)
        {
            if (item != null)
            {
                AddDialog(item);
            }
        }
    }
Ejemplo n.º 3
0
        public static int AddDialogInfo(DialogInfo dialogInfo)
        {
            int    newMessageId = 0;
            string query        = $@"insert into dbo.DialogInfos (UserId, RespondentId, ShowMessagesFromId) 
values (@UserId, @RespondentId, @ShowMessagesFromId);
DECLARE @newDialogInfoId int;
   SELECT @newDialogInfoId = SCOPE_IDENTITY();
   SELECT @newDialogInfoId";

            var connect    = new SqlConnection(connStr);
            var sqlCommand = new SqlCommand(query, connect);

            sqlCommand.Parameters.AddWithValue("UserId", dialogInfo.UserId);
            sqlCommand.Parameters.AddWithValue("RespondentId", dialogInfo.RespondentId);
            sqlCommand.Parameters.AddWithValue("ShowMessagesFromId", dialogInfo.ShowMessagesFromId);

            try
            {
                connect.Open();
                newMessageId = (int)sqlCommand.ExecuteScalar();
            }
            catch (Exception ex)
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                throw new Exception("in DialogInfosDAL." + methodName + "(): " + ex);
            }
            finally
            {
                connect.Close();
            }

            return(newMessageId);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 通过string[] arrStrAudioPath = Directory.GetFiles();这个方法获取_Audio文件夹下所有对象的一个path,然后单个循环获取所有object
    /// </summary>
    /// <returns></returns>
    private List <DialogInfo> GetAllAsset()
    {
        //获取所有object的路径
        string[]          arrStrAudioPath = Directory.GetFiles(Application.dataPath + "/DialogText/DialogInfos/", "*", SearchOption.AllDirectories);
        List <DialogInfo> list            = new List <DialogInfo>();


        //循环遍历每一个路径,单独加载
        foreach (string strAudioPath in arrStrAudioPath)
        {
            if (strAudioPath.Contains(".meta"))
            {
                continue;
            }
            //替换路径中的反斜杠为正斜杠       
            string strTempPath = strAudioPath.Replace(@"\", "/");
            //截取我们需要的路径
            strTempPath = strTempPath.Substring(strTempPath.IndexOf("Assets"));
            //根据路径加载资源
            DialogInfo dialogInfo = ResourceLoadManager.Instance.Load <DialogInfo>(@strTempPath);
            if (dialogInfo != null)//过滤掉meta文件
            {
                list.Add(dialogInfo);
            }
        }
        return(list);
    }
Ejemplo n.º 5
0
        public static DialogInfo GetDialogInfo(int userId, int respondentId)
        {
            DialogInfo result = null;
            string     query  = $"select * from dbo.DialogInfos where UserId = {userId} and RespondentId = {respondentId}";

            var connection = new SqlConnection(connStr);
            var sqlCommand = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                var reader = sqlCommand.ExecuteReader();
                if (reader.Read())
                {
                    result = ReadDialogInfoInfo(reader);
                }

                reader.Close();
            }
            catch (Exception ex)
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                throw new Exception("in DialogInfosDAL." + methodName + "(): " + ex);
            }
            finally
            {
                connection.Close();
            }

            return(result);
        }
Ejemplo n.º 6
0
        private static float CalculateChance(SaveData.Heroine heroine, DialogInfo dialogInfo, int answer)
        {
            // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
            switch (dialogInfo.QuestionInfo.QuestionType)
            {
            case QuestionType.Likes:
                // memory + relationship at 23:1 ratio
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 23, 1));

            case QuestionType.Personality:
                // memory + relationship at 1:1 ratio
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 1, 1));

            case QuestionType.PhysicalAttributes:
                // memory + relationship + intelligence at 5:1:3 ratio + intimacy bonus
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 5, 1, 3, heroine.intimacy / 1000f));


            case QuestionType.Invitation:
                // memory + relationship + intelligence at 1:3:5 ratio + bonus (because obvious)
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 1, 3, 5, InvitationBonus));
            }

            return(0f);
        }
Ejemplo n.º 7
0
    public static DialogInfo dataToObject(SqliteDataReader reader)
    {
        DialogInfo dialogInfo = new DialogInfo();

        dialogInfo.id              = reader.GetInt16(reader.GetOrdinal("id"));
        dialogInfo.avatar          = reader.GetString(reader.GetOrdinal("avatar"));
        dialogInfo.name            = reader.GetString(reader.GetOrdinal("name"));
        dialogInfo.actorId         = reader.GetInt16(reader.GetOrdinal("actorId"));
        dialogInfo.type            = reader.GetString(reader.GetOrdinal("type"));
        dialogInfo.delay           = (long)reader.GetInt16(reader.GetOrdinal("delay"));
        dialogInfo.text            = reader.GetString(reader.GetOrdinal("text"));
        dialogInfo.voice           = reader.GetString(reader.GetOrdinal("voice"));
        dialogInfo.video           = reader.GetString(reader.GetOrdinal("video"));
        dialogInfo.image           = reader.GetString(reader.GetOrdinal("image"));
        dialogInfo.input           = reader.GetString(reader.GetOrdinal("input"));
        dialogInfo.option_1_text   = reader.GetString(reader.GetOrdinal("option_1_text"));
        dialogInfo.option_1_script = reader.GetString(reader.GetOrdinal("option_1_script"));
        dialogInfo.option_1_id     = reader.GetInt16(reader.GetOrdinal("option_1_id"));
        dialogInfo.option_2_text   = reader.GetString(reader.GetOrdinal("option_2_text"));
        dialogInfo.option_2_script = reader.GetString(reader.GetOrdinal("option_2_script"));
        dialogInfo.option_2_id     = reader.GetInt16(reader.GetOrdinal("option_2_id"));
        dialogInfo.continueKey     = reader.GetInt16(reader.GetOrdinal("continueKey"));
        dialogInfo.continueValue   = reader.GetInt16(reader.GetOrdinal("continueValue"));
        dialogInfo.actionKey       = reader.GetInt16(reader.GetOrdinal("actionKey"));
        dialogInfo.actionValue     = reader.GetInt16(reader.GetOrdinal("actionValue"));
        dialogInfo.activeTime      = (long)reader.GetInt16(reader.GetOrdinal("activeTime"));
        return(dialogInfo);
    }
Ejemplo n.º 8
0
        public void DisplayDialogInfo(string info)
        {
            DialogInfo dialogInfoForm = new DialogInfo();

            dialogInfoForm.label.Text = info;
            dialogInfoForm.ShowDialog();
        }
Ejemplo n.º 9
0
        public void callWrite(string pMessage)
        {
            try
            {
                if (mPass == "" || mPass == null)
                {
                    mPass = checkCeredentials();
                }

                if (mPass != null && mPass != "")
                {
                    int lResult = readWriteClass.writeData(pMessage, mPass);

                    DialogInfo msg = lResult == 0 ? new DialogInfo(DialogInfo.TypeMsg.Info, "Contraseña guardada") : new DialogInfo(DialogInfo.TypeMsg.Error, "Se ha produdcido un erro al guardar la contraseña");

                    msg.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    msg.ShowDialog();
                }
                else if (mPass != null)
                {
                    DialogInfo passError = new DialogInfo(DialogInfo.TypeMsg.Error, "El password maestro introducido no es correcto");
                    passError.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                callLogger("Método callWrite() de la clase Controller => " + ex.ToString() + "__" + DateTime.Now);
            }
        }
Ejemplo n.º 10
0
        public void callRemoveData()
        {
            try
            {
                DialogQuestion msg = new DialogQuestion("Se va a borrar toda la información almacenada, quiere continuar ?");

                bool?lResult = msg.ShowDialog();

                if (lResult != null && lResult.ToString().ToUpper() == "TRUE")
                {
                    string lPass = checkCeredentials();

                    if (lPass != null && lPass != "")
                    {
                        bool       lRemoveResult = readWriteClass.removeData();
                        DialogInfo resultMsg     = new DialogInfo(lRemoveResult ? DialogInfo.TypeMsg.Info : DialogInfo.TypeMsg.Error, lRemoveResult ? "Los datos han sido borrados" : "No se han podido borrar los datos");
                        resultMsg.ShowDialog();
                        mPass = "";
                    }
                    else if (lPass != null)
                    {
                        DialogInfo passError = new DialogInfo(DialogInfo.TypeMsg.Error, "El password maestro introducido no es correcto");
                        passError.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                callLogger("Método callRemoveData() de la clase Controller => " + ex.ToString() + "__" + DateTime.Now);
            }
        }
Ejemplo n.º 11
0
        public ObservableCollection <MainWindow.GridDataRow> callRead()
        {
            ObservableCollection <MainWindow.GridDataRow> lData = null;

            try
            {
                readWriteClass.checkDataExists();

                if (mPass == "" || mPass == null)
                {
                    mPass = checkCeredentials();
                }

                if (mPass != null && mPass != "")
                {
                    lData = readWriteClass.readData(mPass);
                }
                else if (mPass != null)
                {
                    DialogInfo passError = new DialogInfo(DialogInfo.TypeMsg.Error, "El password maestro introducido no es correcto");
                    passError.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                callLogger("Método callRead() de la clase Controller => " + ex.ToString() + "__" + DateTime.Now);
                lData = null;
            }

            return(lData);
        }
Ejemplo n.º 12
0
        List <DialogInfo> DialogSequence_GetDialogList(On.DialogSequence.orig_GetDialogList orig, DialogSequence self)
        {
            //Using this function to add some of my own dialog stuff to the game.
            if (randoStateManager.IsRandomizedFile && (self.dialogID == "RANDO_ITEM"))
            {
                Console.WriteLine("Trying some rando dialog stuff.");
                List <DialogInfo> dialogInfoList = new List <DialogInfo>();
                DialogInfo        dialog         = new DialogInfo();
                switch (self.dialogID)
                {
                case "RANDO_ITEM":
                    dialog.text = $"You have received item: '{self.name}'";
                    break;

                default:
                    dialog.text = "???";
                    break;
                }


                dialogInfoList.Add(dialog);

                return(dialogInfoList);
            }

            return(orig(self));
        }
Ejemplo n.º 13
0
    private void showView(DialogInfo di)
    {
//		Debug.Log(di.GetType().GetProperties()[0].Name);
//		listView.transform.position = new Vector3(listView.transform.position.x, 99999);
        if (di.type == "text")
        {
            showText(di);
        }
        else if (di.type == "voice")
        {
            showVoice(di);
        }
        else if (di.type == "video")
        {
            showVideo(di);
        }
        else if (di.type == "image")
        {
            showImage(di);
        }
        else if (di.type == "option")
        {
            showOption(di);
        }
        else if (di.type == "input")
        {
            showInput(di);
        }
    }
Ejemplo n.º 14
0
 public void ProcessDialogAnswered(SaveData.Heroine heroine, DialogInfo dialogInfo)
 {
     if (heroine != null && dialogInfo != null)
     {
         heroine.Remember(dialogInfo.QuestionId, dialogInfo.SelectedAnswerId);
     }
 }
Ejemplo n.º 15
0
        public void Open(string dialogName, string scriptName, bool keepPrev = false)
        {
            DialogInfo prefInfo = null;

            if (_dialog_stack.Count > 0 && !keepPrev)
            {
                prefInfo = _dialog_stack.Peek();
            }

            DialogInfo info = new DialogInfo();

            info.dialogName = dialogName;
            info.scriptName = scriptName;

            if (ShowDialog(info))
            {
                _dialog_stack.Push(info);

                // close prev dialog
                if (prefInfo != null)
                {
                    Destroy(prefInfo.dialog);
                    prefInfo.dialog = null;
                }
            }
        }
Ejemplo n.º 16
0
        public static bool UpdateDialogInfo(DialogInfo dialogInfo)
        {
            string query = $"update dbo.DialogInfos set ShowMessagesFromId={dialogInfo.ShowMessagesFromId} where Id = {dialogInfo.Id}";

            var connect    = new SqlConnection(connStr);
            var sqlCommand = new SqlCommand(query, connect);

            int result = 0;

            try
            {
                connect.Open();
                result = sqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                throw new Exception("in DialogInfosDAL." + methodName + "(): " + ex);
            }
            finally
            {
                connect.Close();
            }

            return(result > 0);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Überprüft, ob die Angaben im Dialog korrekt sind und beendet anschließend (ggf.) den DIalog
 /// </summary>
 /// <param name="element"></param>
 /// <param name="points"></param>
 private void ConnectCallback(UIElement element, TouchGroup points)
 {
     this.Invoke(new Action(() =>
     {
         try
         {
             IPAddress ip = IPAddress.Parse(_ipaddress.Text);
             int port     = int.Parse(_port.Text);
             if (port > 0 && port <= 9999)
             {
                 OnDialogFinished(new Events.DialogEventArgs(this, CONNECT, port, ip));
             }
             else
             {
                 DialogControl <MessageDialog> .ShowDialog(DialogParent.Surface,
                                                           DialogInfo.CreateMessageInfo("The port must be between 0 and 9999!", true));
             }
         }
         catch
         {
             DialogControl <MessageDialog> .ShowDialog(DialogParent.Surface,
                                                       DialogInfo.CreateMessageInfo(this._ipaddress.Text + " is not a valid ip adress", true));
         }
     }));
 }
Ejemplo n.º 18
0
        DialogInfo GetItemInfo(uint id)
        {
            string query  = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id);
            var    reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query);

            if (reader == null)
            {
                mDialogInfos[id] = null;
                return(null);
            }

            if (!reader.HasRows || !reader.Read())
            {
                mDialogInfos[id] = null;

                reader.Close();
                reader.Dispose();
                return(null);
            }

            DialogInfo info = new DialogInfo();

            info.mId          = id;
            info.mType        = (EDialogType)System.Enum.Parse(typeof(EDialogType), GetReaderString(reader, "type"));
            info.mDialogs     = DBTextResource.ParseArrayUint(GetReaderString(reader, "dialogs"), ",");
            info.mAutoRunTime = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_tun_time"), 0);
            mDialogInfos.Add(info.mId, info);

            reader.Close();
            reader.Dispose();
            return(info);
        }
Ejemplo n.º 19
0
        private static void Query(Organization organization)
        {
            Console.WriteLine("Query");

            string fileCabinetId = "00000000-0000-0000-0000-000000000000";
            string dialogId      = "00000000-0000-0000-0000-000000000000";

            DialogExpression dialogExpression = new DialogExpression()
            {
                Operation = DialogExpressionOperation.And,
                Condition = new List <DialogExpressionCondition>()
                {
                    DialogExpressionCondition.Create("NAME", "T*")
                },
                Count     = 100,
                SortOrder = new List <SortedField>()
                {
                    SortedField.Create("NAME", SortDirection.Desc)
                }
            };

            FileCabinet fileCabinet = organization.GetFileCabinetsFromFilecabinetsRelation().FileCabinet
                                      .FirstOrDefault(fc => fc.Id == fileCabinetId);

            if (fileCabinet == null)
            {
                Console.WriteLine("FileCabinet is null!");
            }
            else
            {
                DialogInfos dialogInfos = fileCabinet.GetDialogInfosFromDialogsRelation();

                if (dialogInfos == null)
                {
                    Console.WriteLine("DialogInfos is null!");
                }
                else
                {
                    DialogInfo dialog = dialogInfos.Dialog.FirstOrDefault(d => d.Id == dialogId);

                    if (dialog == null)
                    {
                        Console.WriteLine("Dialog is null!");
                    }
                    else
                    {
                        DocumentsQueryResult documentsQueryResult = dialog.GetDialogFromSelfRelation().GetDocumentsResult(dialogExpression);

                        Console.WriteLine("Query Result");
                        foreach (Document document in documentsQueryResult.Items)
                        {
                            Console.WriteLine($"ID {document.Id}");
                            Console.WriteLine("Fields");
                            document.Fields.ForEach(f => Console.WriteLine($"Name: {f.FieldName} - Item: {f.Item}"));
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
    public DialogInfo AddDialog(DialogType type)
    {
        DialogInfo dialoginfo = new DialogInfo();

        dialoginfo.Type = type;
        this.dialogs.Add(type, dialoginfo);
        return(dialoginfo);
    }
Ejemplo n.º 21
0
 public void ShowDialog(DialogInfo dialog)
 {
     this.dialog      = dialog;
     this.dialogQueue = new List <string>(this.dialog.lines);
     this.PopDialog();
     this.SetVisible(true);
     this.forceStay = Dialog.FORCE_STAY_LENGTH;
 }
Ejemplo n.º 22
0
        public static DialogInfo CreateMessageInfo(string msg, bool error)
        {
            DialogInfo di = new DialogInfo();

            di.Message = msg;
            di.Mode    = error ? ERROR : INFORMATION;
            return(di);
        }
Ejemplo n.º 23
0
 public void CloseAll()
 {
     while (_dialog_stack.Count > 0)
     {
         DialogInfo info = _dialog_stack.Pop();
         DestroyDialogContext(info);
     }
 }
Ejemplo n.º 24
0
    private void showInput(DialogInfo dialogInfo)
    {
        List <GameObject> newGameObjList = this.CopyGameObject(dialogItemInput);
        GameObject        newDialog      = newGameObjList[0];

        newDialog.GetComponentsInChildren <Image> () [1].sprite = (Sprite)Resources.Load(dialogInfo.avatar.Split('.') [0], new Sprite().GetType());
        this.Show(newGameObjList);
    }
Ejemplo n.º 25
0
    /// <summary>
    /// 根据类型增加对话框
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public DialogInfo AddDialog(DialogType type)
    {
        DialogInfo dialogInfo = new DialogInfo();
        dialogInfo.Type = type;
        this.dialogs.Add(type,dialogInfo);

        return dialogInfo;
    }
Ejemplo n.º 26
0
 public void ProcessDialogAnswered(SaveData.Heroine heroine, DialogInfo dialogInfo, bool isCorrect)
 {
     if (heroine == null || dialogInfo == null)
     {
         return;
     }
     heroine.Remember(dialogInfo.QuestionId, dialogInfo.SelectedAnswerId, isCorrect);
 }
Ejemplo n.º 27
0
    private void UpdateGazePointCloud(GazePoint gazePoint)
    {
        _last = Next();
        _gazePoints[_last] = gazePoint;
        var     cloudPointVisualizer = _gazePointCloudSprites[_last].GetComponent <CloudPointVisualizer>();
        Vector3 gazePointInWorld     = ProjectToPlaneInWorld(gazePoint);

        var pointer = new PointerEventData(EventSystem.current);

        if (Display.displays.Length > 1)
        {
            pointer.position = new Vector2(gazePoint.Screen.x + 1920, gazePoint.Screen.y);
        }
        else
        {
            pointer.position = gazePoint.Screen;
        }
        Dbg.Log(LogMessageType.TOBII, new List <string>()
        {
            pointer.position.x.ToString(), pointer.position.y.ToString()
        });
        var raycastResults = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointer, raycastResults);

        if (raycastResults.Count > 0)
        {
            GameObject touchedObject = raycastResults[0].gameObject;
            DialogInfo dialogInfo    = touchedObject.GetComponent <DialogInfo>();
            if (dialogInfo != null)
            {
                if (dialogInfo.gameObject != lastDialogGameObject)
                {
                    timeGazingAtInfo = DateTime.UtcNow;
                }
                else
                {
                    if ((DateTime.UtcNow - timeGazingAtInfo).TotalMilliseconds > TimeToPopOptionsInDialogInfo)
                    {
                        dialogInfo.InstantiateWizardButtons();
                        timeGazingAtInfo = DateTime.UtcNow;
                    }
                }
                lastDialogGameObject = dialogInfo.gameObject;
                //if (Type == DialogType.Piece)
                //{
                //    LastColorUsed = this.color.ToString();
                //}
                //string text = touchedObject.GetComponentInChildren<Text>().text;
                //if (name == "Hint")
                //    wizardButtonPressed.ExecuteAction(transform.parent.name);
                //else wizardButtonPressed.ExecuteAction(transform.name);
            }
        }


        cloudPointVisualizer.NewPosition(gazePoint.Timestamp, gazePointInWorld);
    }
Ejemplo n.º 28
0
 public Server()
 {
     nodeInformation  = new NodeInformation();
     serializer       = new Serializer();
     CommonDialog     = new DialogInfo("Common dialog", 0);
     Clients          = new Dictionary <int, Client>();
     ConnectionsCount = 0;
     Connections      = new Dictionary <int, Connection>();
 }
Ejemplo n.º 29
0
    private int baseItemSize = 5;     //标准item行数;

    // Use this for initialization
    void Start()
    {
        initObject();
        loadArchive();
        loadHistory();
        dialogInfo = DialogInfo.getDialogInfo(this.sessionInfo);
        InvokeRepeating("UpdateDialog", 0, 0.1f);
        InvokeRepeating("AutoScroll", 0, 0.05f);
    }
Ejemplo n.º 30
0
 /// <summary>
 /// to next dialog;
 /// get new DialogInfo
 /// </summary>
 /// <param name="isNeed">If set to <c>true</c> is need.</param>
 public void next(bool isNeed)
 {
     if (isNeed) {
         if (curId < curJson ["data"].Count - 1) {
             this.curId++;
             this.curDialogInfo = getDialogInfo ();
         }
     }
 }
Ejemplo n.º 31
0
    public static DialogInfo getDialogInfo(string dialogScript, int dialogId)
    {
        SQLiteUtils      sqlUtils = new SQLiteUtils();
        SqliteDataReader reader   = sqlUtils.findSql(dialogScript, dialogId);

        reader.Read();
        DialogInfo dialogInfo = dataToObject(reader);

        return(dialogInfo);
    }
Ejemplo n.º 32
0
    public static DialogInfo getDialogInfo(SessionInfo sessionInfo)
    {
        SQLiteUtils      sqlUtils = new SQLiteUtils();
        SqliteDataReader reader   = sqlUtils.findSql(sessionInfo.dialogScript, sessionInfo.dialogId);

        reader.Read();
        DialogInfo dialogInfo = dataToObject(reader);

        return(dialogInfo);
    }
Ejemplo n.º 33
0
 private void addHistoryButton(DialogInfo di)
 {
     GameObject newSelectButton = Instantiate(selectButtonExample);
     Button buttonLeft = newSelectButton.transform.GetChild (0).GetComponent<Button>();
     buttonLeft.transform.GetChild (0).GetComponent<Text> ().text = di.getSelect () [0].getOption ();
     buttonLeft.enabled = false;
     Button buttonRight = newSelectButton.transform.GetChild (1).GetComponent<Button>();
     buttonRight.transform.GetChild (0).GetComponent<Text> ().text = di.getSelect () [1].getOption ();
     buttonRight.enabled = false;
     newSelectButton.transform.SetParent (mainListViewGrid.transform);
     newSelectButton.transform.localScale = new Vector3 (1, 1, 1);
     newSelectButton.SetActive (true);
 }
Ejemplo n.º 34
0
 private void addItem(DialogInfo di)
 {
     if (!di.getVoice ().Equals (string.Empty)) {
         playVideo(di.getVoice ());
     }
     if (di.getType() == DialogType.Dialog) {
         addTextItem (di);
     } else {
         addSelectButton(di);
     }
     if (di.getDelay () > 0) {
         Utils.saveWakeTimeStamp(di.getDelay ());
     }
 }
Ejemplo n.º 35
0
 private void addSelectButton(DialogInfo di)
 {
     GameObject newSelectButton = Instantiate(selectButtonExample);
     Button buttonLeft = newSelectButton.transform.GetChild (0).GetComponent<Button>();
     buttonLeft.transform.GetChild (0).GetComponent<Text> ().text = di.getSelect () [0].getOption ();
     buttonLeft.onClick.AddListener (delegate() {
         this.clickButton (newSelectButton, di.getSelect () [0], 0);
     });
     Button buttonRight = newSelectButton.transform.GetChild (1).GetComponent<Button>();
     buttonRight.transform.GetChild (0).GetComponent<Text> ().text = di.getSelect () [1].getOption ();
     buttonRight.onClick.AddListener (delegate() {
         this.clickButton (newSelectButton, di.getSelect () [1], 1);
     });
     newSelectButton.transform.SetParent (mainListViewGrid.transform);
     newSelectButton.transform.localScale = new Vector3 (1, 1, 1);
     newSelectButton.SetActive (true);
 }
Ejemplo n.º 36
0
 public bool ShowDialogInfo(int dialogID, GUIPlotDialog.FinishCallback callBackEvent, GUIPlotDialog.VoidCallback showNextEvent)
 {
     this.curDialogInfo = Globals.Instance.AttDB.DialogDict.GetInfo(dialogID);
     if (this.curDialogInfo == null)
     {
         global::Debug.LogError(new object[]
         {
             string.Format("DialogDict.GetInfo error, ID = {0}", dialogID)
         });
         this.CloseDialog();
         return false;
     }
     this.FinishEvent = callBackEvent;
     this.ShowNextEvent = showNextEvent;
     base.gameObject.SetActive(true);
     this.ShowDialog();
     return true;
 }
Ejemplo n.º 37
0
 /// <summary>
 /// select to subfield;
 /// get the new DialogInfo
 /// </summary>
 /// <param name="op">Op.</param>
 public void toSubfield(Option op)
 {
     this.curJsonFile = op.getSubfield();
     this.curId = op.getTarId();
     reloadJsonFile ();
     this.curDialogInfo = getDialogInfo ();
 }
Ejemplo n.º 38
0
 private DialogInfo getDialogInfo()
 {
     JsonData jdDialog = this.curJson ["data"][this.curId];
     DialogInfo di = new DialogInfo ();
     di.setId (this.curId);
     if (int.Parse(jdDialog ["type"].ToString()) == 1) {
         di.setType (DialogType.Select);
         JsonData jdo = jdDialog["select"];
         for (int i=0;i<jdo.Count;i++){
             Option op = new Option();
             op.setSubfield(Utils.PathURL + jdo[i]["subfield"].ToString());
             op.setTarId(int.Parse(jdo[i]["tarId"].ToString()));
             op.setOption(jdo[i]["option"].ToString());
             di.addOption(op);
         }
     } else {
         di.setType (DialogType.Dialog);
         di.setContent (jdDialog ["content"].ToString());
         try{
             di.setVoice(jdDialog["voice"].ToString());
         }catch(Exception ex){
             di.setVoice(string.Empty);
         }
     }
     try{
         di.setDelay(long.Parse(jdDialog["delay"].ToString()));
     }catch(Exception ex){
         di.setDelay(0);
     }
     return di;
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReadJson"/> class;
 /// can get the new DialogInfo
 /// </summary>
 public ReadJson()
 {
     loadRecord ();
     reloadJsonFile ();
     this.curDialogInfo = getDialogInfo ();
 }
Ejemplo n.º 40
0
 private void UpdateNextInfo()
 {
     if (this.curDialogInfo.NextID == 0)
     {
         this.CloseDialog();
         return;
     }
     this.curDialogInfo = Globals.Instance.AttDB.DialogDict.GetInfo(this.curDialogInfo.NextID);
     if (this.curDialogInfo == null)
     {
         global::Debug.LogError(new object[]
         {
             string.Format("DialogDict.GetInfo error, ID = {0}", this.curDialogInfo.NextID)
         });
         this.CloseDialog();
         return;
     }
     this.ShowDialog();
     if (this.ShowNextEvent != null)
     {
         this.ShowNextEvent();
     }
 }
Ejemplo n.º 41
0
 private void addTextItem(DialogInfo di)
 {
     Text newText = Instantiate(textExample);
     newText.text = di.getContent ();
     newText.transform.SetParent (mainListViewGrid.transform);
     newText.transform.localScale = new Vector3 (1, 1, 1);
 }
Ejemplo n.º 42
0
        public void Load(string dialog, Texture2D backGround)
        {
            m_dialog = DataReader.Load<DialogInfo>("Data/Dialogs/" + dialog);
            m_talkState = 0;
            m_lastState = true;
            m_backGround = backGround;

            m_alpha = 0;
        }