Ejemplo n.º 1
0
    void OnStorageEventHandler(int event_id, CSEntity entity, object arg)
    {
        switch (event_id)
        {
        case CSConst.eetStorage_HistoryEnqueue:
        {
            HistoryStruct          hs  = arg as HistoryStruct;
            CSUI_SubStorageHistory ssh = _addHistoryItem(hs);
            if (ssh != null)
            {
                ssh.AddHistory(hs.m_Value);
            }
        } break;

        case CSConst.eetStorage_HistoryDequeue:
        {
//			HistoryStruct hs = arg as HistoryStruct;
            if (m_SubHistorys.Count != 0)
            {
                m_SubHistorys[0].PopImmediate();

                if (m_SubHistorys[0].IsEmpty)
                {
                    Destroy(m_SubHistorys[0].gameObject);
                    m_SubHistorys.RemoveAt(0);
                }
            }
        } break;

        case CSConst.eetStorage_PackageRemoveItem:
        {
            StorageMainUI.RestItems();
        } break;
        }
    }
Ejemplo n.º 2
0
        private void buttonSelect_Click(object sender, EventArgs e)
        {
            string path = (string)dataGridViewHistory.SelectedCells[0].Value;

            if (dataGridViewHistory.Rows.Count <= 1)
            {
                return;
            }

            if (path == "Current")
            {
                path = (string)dataGridViewHistory.Rows[1].Cells[0].Value;
            }

            string json;

            if (File.Exists(path))
            {
                json = File.ReadAllText(path);
            }
            else
            {
                throw new Exception(
                          "Error! According to this path: \"" +
                          path +
                          "\" file not found");
            }

            HistoryStruct hs =
                JsonConvert.DeserializeObject <HistoryStruct>(json);

            /* the 24 char is xx_xx_xx xx_xx_xxxx.json */
            int startInd = path.Length - 24;

            /* the 19 char is xx_xx_xx xx_xx_xxxx */
            path = path.Substring(startInd, 19);

            DateTime dt = DateTime.ParseExact(
                path,
                UtilityDateTime.DataFormat,
                CultureInfo.InvariantCulture
                );

            string date =
                "Date: " + dt.ToString("dd:MM:yyyy") +
                " Time: " + dt.ToString("HH:mm:ss");

            FormDataBaseWork.simple.SetResultsToPagesWithoutSaving(hs, date);

            Close();
        }
Ejemplo n.º 3
0
        public static void Save(DataTable dataTable, string log, string dbName)
        {
            HistoryStruct st = new HistoryStruct();
            DataSet       ds = new DataSet();

            ds.Tables.Add(dataTable);
            st.dataSet = ds;
            st.log     = log;
            st.dbName  = dbName;
            StringValue fileName = dirHistory + "/History " +
                                   UtilityDateTime.GetCurrentTime() +
                                   ".json";
            string json = JsonConvert.SerializeObject(st);

            File.WriteAllText(fileName.ToString(), json);
            AddFile(fileName);
        }
Ejemplo n.º 4
0
    private CSUI_SubStorageHistory _addHistoryItem(HistoryStruct history)
    {
        if (m_SubHistorys.Count != 0)
        {
            CSUI_SubStorageHistory curSub = m_SubHistorys[m_SubHistorys.Count - 1];
            if (curSub.Day == history.m_Day)
            {
                return(curSub);
            }
        }
        CSUI_SubStorageHistory curSubHistory = Instantiate(m_SubHistoryPrefab) as CSUI_SubStorageHistory;

        curSubHistory.transform.parent        = m_HistoryRootUI.transform;
        curSubHistory.transform.localPosition = Vector3.zero;
        curSubHistory.transform.localRotation = Quaternion.identity;
        curSubHistory.transform.localScale    = Vector3.one;
        curSubHistory.Day          = history.m_Day;
        curSubHistory.onReposition = OnSubHistoryReposition;

        m_SubHistorys.Add(curSubHistory);
        return(curSubHistory);
    }
Ejemplo n.º 5
0
    public void AddHistory(CSStorageHistoryAttr historyAttr)
    {
        HistoryStruct hs = new HistoryStruct();

        hs.m_Day = historyAttr.m_Day;
        switch (historyAttr.m_Type)
        {
        case CSStorageHistoryAttr.EType.NpcAddSth:
        {
            string str = historyAttr.m_TimeStrColor + historyAttr.m_TimeStr + UIMsgBoxInfo.mStorageHistory_1.GetString();
            hs.m_Value = CSUtils.GetNoFormatString(str, historyAttr.m_NameColorStr + historyAttr.m_NpcName + "[FFFFFF]", historyAttr.m_ItemStr);
        }
        break;

        case CSStorageHistoryAttr.EType.NpcUseSth:
        {
            string str = historyAttr.m_TimeStrColor + historyAttr.m_TimeStr + UIMsgBoxInfo.mStorageHistory_2.GetString();
            hs.m_Value = CSUtils.GetNoFormatString(str, historyAttr.m_NameColorStr + historyAttr.m_NpcName + "[FFFFFF]", historyAttr.m_ItemStr);
        }
        break;

        default:
            break;
        }

        Data.m_History.Enqueue(hs);

        ExcuteEvent(CSConst.eetStorage_HistoryEnqueue, hs);

        if (Data.m_History.Count > c_HistorMaxCount)
        {
            HistoryStruct str = Data.m_History.Dequeue();

            ExcuteEvent(CSConst.eetStorage_HistoryDequeue, str);
            Debug.Log("Storage history [" + str + "] remove.");
        }
    }
Ejemplo n.º 6
0
 public void SetResultsToPages(HistoryStruct hs, string status)
 {
     SetResultsToPages(hs.dataSet.Tables[0], hs.log, hs.dbName, status);
 }