定义游戏数据对象的抽象实现
Inheritance: IDataHost
Exemplo n.º 1
0
        /// <summary>
        /// 从 JSON 数据中初始化对象
        /// </summary>
        /// <param name="dataService">游戏数据服务</param>
        /// <param name="host">数据宿主</param>
        /// <param name="data">JSON 数据保存对象</param>
        internal void InitializeData(IGameDataService dataService, GameDataItem host, JsonDataObject data)
        {
            DataService = dataService;
            Host        = host;

            _data = data;
            Initialize();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存游戏数据对象
        /// </summary>
        /// <param name="dataItem"></param>
        public void Save(GameDataItem dataItem)
        {
            var unit = dataItem as Unit;

            if (unit != null)
            {
                Save(unit);
                return;
            }


            var place = dataItem as Place;

            if (place != null)
            {
                Save(place);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存游戏数据对象
        /// </summary>
        /// <param name="dataItem"></param>
        public void Save( GameDataItem dataItem )
        {
            var unit = dataItem as Unit;

              if ( unit != null )
              {
            Save( unit );
            return;
              }

              var place = dataItem as Place;

              if ( place != null )
              {
            Save( place );
              }
        }
Exemplo n.º 4
0
 public SaveTransaction( GameDataItem dataItem )
 {
     Monitor.Enter( dataItem._saveSync );
     dataItem._saveTransaction = this;
     _dataItem = dataItem;
 }
Exemplo n.º 5
0
        /// <summary>
        /// 从 JSON 数据中初始化对象
        /// </summary>
        /// <param name="dataService">游戏数据服务</param>
        /// <param name="host">数据宿主</param>
        /// <param name="data">JSON 数据保存对象</param>
        internal void InitializeData( IGameDataService dataService, GameDataItem host, JsonDataObject data )
        {
            DataService = dataService;
              Host = host;

              _data = data;
              Initialize();
        }
Exemplo n.º 6
0
 public SaveTransaction(GameDataItem dataItem)
 {
     Monitor.Enter(dataItem._saveSync);
     dataItem._saveTransaction = this;
     _dataItem = dataItem;
 }