Пример #1
0
        public static SceneItemData CreateSceneItemData(SceneData sd, string sceneItemId, string itemId)
        {
            SceneItemData sid = new SceneItemData {
                archiveId        = sd.ArchiveId,
                sceneId          = sd.SceneId,
                sceneItemId      = sceneItemId,
                itemId           = itemId,
                pickUp           = false,
                persistenceState = PersistenceState.New
            };

            sd.SceneItemsDatas.Add(sceneItemId, sid);
            return(sid);
        }
Пример #2
0
        public static SceneData LoadSceneData(string archiveId, string sceneId)
        {
            SceneData sd = new SceneData {
                archiveId = archiveId, sceneId = sceneId, persistenceState = PersistenceState.New
            };

            Repository.Instance.Submit(
                new Command(sd.RetrieveCommandText(), (dataReader) => {
                if (dataReader.Read())
                {
                    sd.entry            = dataReader.GetString(0) == "1" ? true : false;
                    sd.persistenceState = PersistenceState.NoChange;
                }
            })
                );
            SceneItemData.LoadSceneItemDatas(sd);
            return(sd);
        }
Пример #3
0
        public static void LoadSceneItemDatas(SceneData sd)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from scene_item_datas where archive_id = '").Append(sd.ArchiveId).Append("' and scene_id = '").Append(sd.SceneId).Append("'");
            Repository.Instance.Submit(
                new Command(sb.ToString(), (dataReader) => {
                sd.SceneItemsDatas.Clear();
                SceneItemData sid;
                while (dataReader.Read())
                {
                    sid = new SceneItemData {
                        archiveId   = dataReader.GetString(0),
                        sceneId     = dataReader.GetString(1),
                        sceneItemId = dataReader.GetString(2),
                        itemId      = dataReader.GetString(3),
                        pickUp      = dataReader.GetString(4) == "1" ? true : false
                    };
                    sd.SceneItemsDatas.Add(sid.SceneItemId, sid);
                }
            })
                );
        }
Пример #4
0
        public void PickUpItem(string sceneItemId, string itemId)
        {
            SceneItemData sid = SceneItemData.CreateSceneItemData(this, sceneItemId, itemId);

            sid.PickUp = true;
        }