/// <summary> /// 根据DataID获取类结构 /// </summary> public List <object> GetUnPackClassStructByDataID(DataID dataID) { List <object> list = null; unPackClassStructDict.TryGetValue(dataID, out list); return(list); }
/// <summary> /// 添加解包中的类结构List<object>形式存储,DataID区分 /// </summary> /// <param name="protocolNo">协议号</param> /// <param name="objectList">封包成员列表</param> public void AddUnPackClassStructToDict(DataID dataID, List <object> objectList) { if (unPackClassStructDict.ContainsKey(dataID)) { return; } unPackClassStructDict.Add(dataID, objectList); }
public override Int32 GetHashCode() { return(GameID.GetHashCode() ^ DataID.GetHashCode() ^ SaveTime.GetHashCode() ^ DataName.GetHashCode() ^ ScoreValue.GetHashCode()); }
protected override void InitInstance(object[] parameter) { if (parameter.Length != 1) { throw new Burntime.Framework.BurntimeLogicException(); } wayData = ResourceManager.GetData((string)parameter[0]); }
/// <summary> /// Sends a DELETE request to Production Data Server (PDS) client. /// </summary> /// <param name="item">DELETE request description.</param> /// <param name="surveyedSurfaces">Returned list of Surveyed Surfaces.</param> /// <returns>True if the processed request from PDS was successful, false - otherwise.</returns> /// protected override bool SendRequestToPdsClient(object item, out TSurveyedSurfaceDetails[] surveyedSurfaces) { surveyedSurfaces = null; ProjectID projectId = (item as Tuple <ProjectID, DataID>).Item1; DataID surveyedSurfaceId = (item as Tuple <ProjectID, DataID>).Item2; return(raptorClient.DiscardGroundSurfaceFileDetails(projectId.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, surveyedSurfaceId.dataId)); }
protected override void InitInstance(object[] parameter) { if (parameter.Length != 1) { throw new BurntimeLogicException(); } mapData = ResourceManager.GetData((string)parameter[0], ResourceLoadType.LinkOnly); }
public override void AddData(string name, object value) { switch (name) { case "КодАктёра": DataID.Add((int)value); break; case "КодКонтента": ContentID.Add((int)value); break; default: MessageBox.Show($"Поле {name} отсутствует!"); break; } }
public IntroScene(Module App) : base(App) { timeout = new FadingHelper(); Music = "20_MUS 20_HSC.ogg"; Position = (app.Engine.GameResolution - new Vector2(320, 200)) / 2; Size = new Vector2(320, 200); app.RenderMouse = false; CaptureAllMouseClicks = true; ConfigFile intro = new ConfigFile(); intro.Open("intro.txt"); pages = new IntroPage[intro["intro"].GetInt("pages")]; for (int i = 0; i < pages.Length; i++) { pages[i].Map = intro["page" + i].GetInt("map"); pages[i].Time = intro["page" + i].GetFloat("time"); pages[i].Scrolling = intro["page" + i].GetFloat("scrolling"); DataID <MapData> mapData = app.ResourceManager.GetData("classicmap@mat_" + pages[i].Map.ToString("D3") + ".raw??" + pages[i].Map); pages[i].MapData = mapData.Object; } animations = new IntroAnimation[intro["intro"].GetInt("animations")]; for (int i = 0; i < animations.Length; i++) { animations[i].Position = intro["ani" + i].GetVector2("pos"); animations[i].Start = intro["ani" + i].GetFloat("start"); animations[i].Time = intro["ani" + i].GetFloat("time"); animations[i].File = intro["ani" + i].GetString("file"); } view = new MapView(null, app); view.Enabled = false; view.Position = new Vector2(16, 0); view.Size = new Vector2(288, 160); Windows += view; image = new Image(app); image.Position = new Vector2(0, 0); image.Background = null; image.Layer += 20; Windows += image; PreloadAnimations(); }
public ContractExecutionResult GetDel([FromRoute] long projectId, [FromRoute] long surveyedSurfaceId) { ProjectID projId = new ProjectID(projectId); projId.Validate(); DataID ssId = DataID.CreateDataID(surveyedSurfaceId); ssId.Validate(); #if RAPTOR return (RequestExecutorContainerFactory.Build <SurveyedSurfaceExecutorDelete>(logger, raptorClient) .Process(new Tuple <ProjectID, DataID>(projId, ssId))); #else throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "TRex unsupported request")); #endif }
public async Task <ContractExecutionResult> GetDel([FromRoute] Guid projectUid, [FromRoute] long surveyedSurfaceId) { long projectId = await((RaptorPrincipal)User).GetLegacyProjectId(projectUid); var projId = new ProjectID(projectId, projectUid); projId.Validate(); var ssId = DataID.CreateDataID(surveyedSurfaceId); ssId.Validate(); #if RAPTOR return (RequestExecutorContainerFactory.Build <SurveyedSurfaceExecutorDelete>(logger, raptorClient) .Process(new Tuple <ProjectID, DataID>(projId, ssId))); #else throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "TRex unsupported request")); #endif }
protected override void InitInstance(object[] parameter) { if (parameter.Length < 1 || parameter.Length > 2) { throw new BurntimeLogicException(); } data = (DataObject)parameter[0]; if (parameter.Length == 2) { dummy = (string)parameter[1]; } List <DataID <DangerProtection> > list = new List <DataID <DangerProtection> >(); foreach (string str in data.Object.Protection) { list.Add(ResourceManager.GetData(str)); } protection = list.ToArray(); }
protected override void InitInstance(object[] parameter) { if (parameter.Length != 1) { throw new BurntimeLogicException(); } types = container.CreateLinkList <ItemType>(); // load item type data data = ResourceManager.GetData((string)parameter[0]); ItemTypeData[] typesData = data.Object.Items; // add state object links foreach (ItemTypeData typeData in typesData) { types.Add(container.Create <ItemType>(new object[] { typeData })); } foreach (ItemType type in types) { type.InitializeLinks(this); } }
public static JSONNode GetData(DataID type, Vessel vessel) { switch (type) { case DataID.VesselName: return(new JSONString(vessel.vesselName)); case DataID.Situation: return(new JSONString(vessel.situation.ToString())); case DataID.LaunchTime: return(new JSONNumber(vessel.launchTime)); case DataID.MissionTime: return(new JSONNumber(vessel.missionTime)); case DataID.LaunchedFrom: return(new JSONString(vessel.launchedFrom)); case DataID.FullCrewInfo: { var retArr = new JSONArray(); foreach (var crew in vessel.GetVesselCrew()) { var crewObj = new JSONObject(); crewObj.Add("Name", new JSONString(crew.displayName)); crewObj.Add("Gender", new JSONString(crew.gender.Description())); crewObj.Add("Type", new JSONString(crew.type.ToString())); crewObj.Add("Veteran", new JSONBool(crew.veteran)); crewObj.Add("Hero", new JSONBool(crew.isHero)); crewObj.Add("Badass", new JSONBool(crew.isBadass)); crewObj.Add("Level", new JSONNumber(crew.experienceLevel)); crewObj.Add("Courage", new JSONNumber(crew.courage)); crewObj.Add("Stupidity", new JSONNumber(crew.stupidity)); crewObj.Add("Trait", new JSONString(crew.trait)); crewObj.Add("G", new JSONNumber(crew.geeForce)); crewObj.Add("OutG", new JSONBool(crew.outDueToG)); crewObj.Add("Status", new JSONString(crew.rosterStatus.ToString())); crewObj.Add("ID", new JSONString(crew.displayName.GetHashCode().ToString())); retArr.Add(crewObj); } return(retArr); } case DataID.CrewUpdate: { var retObj = new JSONObject(); var crewMembers = vessel.GetVesselCrew(); var screenshotstaken = new Semaphore(crewMembers.Count, crewMembers.Count); foreach (var crew in crewMembers) { var crewObj = new JSONObject(); crewObj.Add("G", new JSONNumber(crew.geeForce)); crewObj.Add("OutG", new JSONBool(crew.outDueToG)); crewObj.Add("Status", new JSONString(crew.rosterStatus.ToString())); screenshotstaken.WaitOne(); CameraUtils.GetImage(crew.seat.portraitCamera, 200, 200, delegate(Texture2D image) { crewObj.Add("Camera", new JSONString("data:image/jpg;base64," + Convert.ToBase64String(image.EncodeToJPG()))); retObj.Add(crew.displayName.GetHashCode().ToString(), crewObj); screenshotstaken.Release(1); }); } foreach (var _ in crewMembers) { screenshotstaken.WaitOne(); } return(retObj); } case DataID.FuelData: { var resourceID = new Dictionary <string, Tuple <int, double, double, JSONObject> >(); var freeID = 0; foreach (var part in vessel.Parts.Where(x => x.Resources.Any())) { foreach (var resource in part.Resources) { var resourceObject = new JSONObject(); Tuple <int, double, double, JSONObject> currResource; if (resourceID.ContainsKey(resource.resourceName)) { currResource = resourceID[resource.resourceName]; } else { currResource = new Tuple <int, double, double, JSONObject>(freeID++, 0, 0, new JSONObject()); resourceID.Add(resource.resourceName, currResource); } resourceObject.Add("ID", new JSONNumber(part.flightID)); resourceObject.Add("Amount", new JSONNumber(resource.amount)); resourceObject.Add("MaxAmount", new JSONNumber(resource.maxAmount)); resourceID[resource.resourceName] = new Tuple <int, double, double, JSONObject>( currResource.Item1, currResource.Item2 + resource.amount, currResource.Item3 + resource.maxAmount, currResource.Item4); if (!currResource.Item4.Linq.Select(x => x.Key) .Contains(part.partInfo.name.GetHashCode().ToString())) { var partTypeObj = new JSONObject(); partTypeObj.Add("Name", part.partInfo.title); partTypeObj.Add("Parts", new JSONArray()); currResource.Item4.Add(part.partInfo.name.GetHashCode().ToString(), partTypeObj); } currResource.Item4[part.partInfo.name.GetHashCode().ToString()]["Parts"].Add(resourceObject); } } var idsObj = new JSONObject(); foreach (var pair in resourceID) { var idObj = new JSONObject(); idObj.Add("Name", new JSONString(pair.Key)); idObj.Add("Amount", new JSONNumber(pair.Value.Item2)); idObj.Add("MaxAmount", new JSONNumber(pair.Value.Item3)); idObj.Add("Parts", resourceID[pair.Key].Item4); idsObj.Add(pair.Value.Item1.ToString(), idObj); } return(idsObj); } default: return(new JSONString("")); } }
public override void WriteDataID(string fieldName, DataID data, int maxLength) { WriteString(fieldName, new TString((data != null) ? data.ToString() : null), maxLength); }
/// <summary> /// Write a DataID. /// </summary> /// <param name="fieldName"></param> /// <param name="data"></param> /// <param name="maxLength"></param> public abstract void WriteDataID(string fieldName, DataID data, int maxLength);
public DataHeader(DataID id, ushort length) { ID = id; Length = length; }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "DataID") { ret = true; if (DataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataGUID") { ret = true; if (DataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataID") { ret = true; if (ParentDataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataGUID") { ret = true; if (ParentDataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeID") { ret = true; if (DataTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeGUID") { ret = true; if (DataTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataValue") { ret = true; if (DataValue.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeID") { ret = true; if (DataRefTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeGUID") { ret = true; if (DataRefTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefID") { ret = true; if (DataRefID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }