/// <summary> /// 設定主/副建築資料 /// </summary> private void initBuildInfo() { SceneObj sceneObj; if (GameCore.NetData.TryGetSceneObjData(Id, out sceneObj) == false) { return; } CastleObj castleObj = sceneObj as CastleObj; if (castleObj.OwnerIsSelf() == false && castleObj.GetBuildCount() == 0) { return; } // 產生建築資訊 var etor = castleObj.GetBuilds(); while (etor.MoveNext()) { builds.Add(BuildInfo.Create(etor.Current, sceneObj.OwnerId())); } // 產生建築GridRoot gridHex.Release(); gridHex.LoadEntity(new MiscEntityData(GameCore.Entity.GenerateSerialId(), gridHexAssetName), (entity) => { entity.CachedTransform.position = CachedTransform.position; gridHex.entity.OnZoom(GameCore.Zoom.Last3DLerp * Constant.NetData.FloatRevert); createBuilds(); }); }
/// <summary> /// 伺服器更新主堡資料 /// </summary> public override void Refresh(object userData) { if (hudEntReq != null && hudEntReq.entity != null) { hudEntReq.entity.Refresh(userData); } SceneObj sceneObj; if (GameCore.NetData.TryGetSceneObjData(Id, out sceneObj) == false) { return; } CastleObj castleObj = sceneObj as CastleObj; if (castleObj.GetBuildCount() == 0) { return; } // 產生建築資訊 var etor = castleObj.GetBuilds(); while (etor.MoveNext()) { if (etor.Current.IsNew == false) { continue; } builds.Add(BuildInfo.Create(etor.Current, sceneObj.OwnerId())); } createBuilds(); }