Example #1
0
    private void writeToDatabase(EmailExecutionObj exeObj)
    {
        EmailDataManager.EmailDataDesc dataDesc = new EmailDataManager.EmailDataDesc(-1, exeObj.WithWho, exeObj.IsPlayerTalking, exeObj.Subject, exeObj.Content, exeObj.Situation_Id);
        List <AppDataManager.DataDesc> dataList = new List <AppDataManager.DataDesc>();

        dataList.Add(dataDesc);
        AppDataManager.SetData(AppDataManager.Protocol.EMAIL_WRITE_TO_HISTORY, dataList);
    }
    public override void OnHide()
    {
        // Write executed news to the history and set the state to finished
        List <AppDataManager.DataDesc> dataDescList = new List <AppDataManager.DataDesc>();

        for (int i = 0; i < currentlyExecutingNews.Count; i++)
        {
            dataDescList.Add(new NewsDataManager.NewsDataDesc(-1, currentlyExecutingNews[i].title, currentlyExecutingNews[i].iconPath, currentlyExecutingNews[i].description));
            AppCallbackModule.Instance.Execute(currentlyExecutingNews[i].appCallback);
        }
        AppDataManager.SetData(AppDataManager.Protocol.NEWS_WRITE_TO_HISTORY, dataDescList);

        // NewsDataManager list up-to-date with the db
        RequestLatestNewsContents();
        currentlyExecutingNews.Clear();
    }
    public void WriteToDatabase(string speaker)
    {
        TextMsgObjEncap temp;

        if (TextMsgObjList.TryGetValue(speaker, out temp))
        {
            string[] messages = temp.textMsgObj.message;
            List <TextDataManager.TextDataDesc> dataToWrite = new List <TextDataManager.TextDataDesc>();
            for (int i = 0; i < messages.Length; i++)
            {
                if (messages[i].Length > 0)
                {
                    dataToWrite.Add(new TextDataManager.TextDataDesc(-1, speaker, messages[i], temp.textMsgObj.playerTalking, temp.textMsgObj.Situation_Id));
                }
            }
            AppDataManager.SetData(AppDataManager.Protocol.TEXT_WRITE_TO_HISTORY, dataToWrite.Cast <AppDataManager.DataDesc>().ToList());
        }
        else
        {
            Debug.LogError("Speaker: " + speaker + " not found");
        }
    }