//设置玩家信息 public static void SetPlayerInfo(this DataNodeComponent dataNode, PlayerInfo player) { IDataNode playerNode = dataNode.GetOrAddNode(Constant.DataNode.PlayerNode); dataNode.SetData <VarPlayerInfo>(Constant.DataNode.PlayerInfo, player, playerNode); GameEntry.Event.Fire(dataNode, new PlayerStateChangedEventArgs(player)); }
//根据配置表加载全部地点 public static void LoadAllSiteByTable(this DataNodeComponent dataNode) { IDataNode siteNode = dataNode.GetOrAddNode(Constant.DataNode.SiteList); IDataTable <DRSite> dtSite = GameEntry.DataTable.GetDataTable <DRSite>(); DRSite[] drSites = dtSite.GetAllDataRows(); foreach (DRSite drSite in drSites) { dataNode.SetData <VarSiteInfo>(drSite.Id.ToString(), new SiteInfo(drSite.Id), siteNode); } }
public static void SetGameInfo(this DataNodeComponent dataNode) { IDataNode gameNode = dataNode.GetOrAddNode(Constant.DataNode.GameNode); GameInfo gameInfo = new GameInfo() { NowSite = 1, NowTime = 0 }; dataNode.SetGameInfo(gameInfo); dataNode.SetData <VarInt>("GameTest", 99, gameNode); }
//设置Game信息 public static void SetGameInfo(this DataNodeComponent dataNode, GameInfo game) { IDataNode gameNode = dataNode.GetOrAddNode(Constant.DataNode.GameNode); dataNode.SetData <VarGameInfo>(Constant.DataNode.GameInfo, game, gameNode); }