public StructureInfo GetStructureInfo(MetaName name) { StructureInfo i = null; structInfos.TryGetValue(name, out i); return(i); }
///// <summary> ///// 数据映射 ///// </summary> ///// <param name="obj">当前对象</param> ///// <param name="value">值</param> ///// <param name="structure">结构</param> ///// <returns></returns> //public virtual object DataMapping(object obj, object value, StructureInfo structure) //{ // try // { // if (!protocol.DataMappings.ContainsKey(structure.DataMapping.Key)) // throw new JTTException($"未找到指定的数据映射标识, DataMappingKey: {structure.DataMapping.Key}."); // var matching = value; // if (!structure.DataMapping.UseDecodeValue) // { // if (structure.DataMapping.Encode != null) // matching = handler.Encode(matching, structure.DataMapping.Encode, structure.Length); // if (structure.DataMapping.Decode != null) // matching = handler.Decode((byte[])matching, structure.DataMapping.Decode); // } // var data = protocol.DataMappings[structure.DataMapping.Key] // .Find(o => o.Matching.ToString() == matching.ToString()); // if (data == null) // throw new JTTException($"数据映射时发生错误,未匹配到数据, DataMappingKey: {structure.DataMapping.Key}, Value: {value}."); // return data; // } // catch (Exception ex) // { // throw new JTTException($"数据映射时发生错误, structureId: {structure.Id}.", ex); // } //} #endregion /// <summary> /// 将结构体数据转为位标识数组 /// </summary> /// <param name="obj">当前对象</param> /// <param name="structure">结构</param> /// <returns></returns> public virtual object ToFlagStruct(object obj, StructureInfo structure) { try { if (structure.Encode.CodeType != CodeType.binary) { throw new JTTException($"数据的编码方式应该为 {CodeType.binary}."); } var flagStructAssembly = string.IsNullOrEmpty(structure.FlagStruct.Assembly) ? Assembly.GetExecutingAssembly() : Assembly.Load(structure.FlagStruct.Assembly); var flagStructType = flagStructAssembly.GetType(structure.FlagStruct.TypeName); var value = obj.GetPropertyValue(structure.FlagStruct.Property.Split('.')); var type = value.GetType(); if (type != flagStructType) { throw new JTTException($"数据的类型 {type.FullName}与配置所指定的类型 {flagStructType.FullName}不匹配."); } return(value.GetBitArray(flagStructType)); } catch (Exception ex) { throw new JTTException($"将位标识数据转为结构体数据时发生错误, structureId: {structure.Id}.", ex); } }
public static IconGroupReusable GetResourcesIconGroupReusable(BlueprintDesign blueprintDesign, bool alwaysUseTextNumbers) { StructureInfo structureInfo = new StructureInfo(blueprintDesign.thingType); IconGroupReusable igr = new IconGroupReusable(alwaysUseTextNumbers); foreach (ResourceTypes resourceType in System.Enum.GetValues(typeof(ResourceTypes))) { //consume or produce resources int iconCount = structureInfo.GetInfoIconCount(resourceType, StructureInfo.InfoTypes.optimum); IconBackgroundTypes ibt = iconCount < 0 ? IconBackgroundTypes.bar : IconBackgroundTypes.circle; if (iconCount != 0) { Texture backgroundTexture = IconGroupReusable.GetIconBackgroundTexture(ibt); Texture texture = ResourceReusable.GetResourceTextureFromResourceType(resourceType); igr.AddIcons(texture, backgroundTexture, Mathf.Abs(iconCount)); } //capacity resources iconCount = structureInfo.GetInfoIconCount(resourceType, StructureInfo.InfoTypes.capacity); if (iconCount > 0) { Texture backgroundTexture = IconGroupReusable.GetIconBackgroundTexture(IconBackgroundTypes.square); Texture texture = ResourceReusable.GetResourceTextureFromResourceType(resourceType); igr.AddIcons(texture, backgroundTexture, iconCount); } } return(igr); }
static string GenerateStructureInfos(StructureInfo def) { var sb = new StringBuilder(); sb.AppendFormat("\t\t\t\tcase {0}:\n", GetMetaNameString(def.StructureNameHash)); sb.AppendFormat("\t\t\t\t\treturn new StructureInfo({0}, {1}, {2}, {3}, {4}, {5}, {6}, new ResourceSimpleArray<StructureEntryInfo>() {{\n", def.StructureNameHash, def.StructureKey, def.Unknown_8h, def.Unknown_Ch, def.EntriesPointer, def.StructureLength, def.Unknown_1Ch); for (int i = 0; i < def.Entries.Count; i++) { var entry = def.Entries[i]; sb.AppendFormat("\t\t\t\t\t\tnew StructureEntryInfo({0}, {1}, StructureEntryDataType.{2}, {3}, {4}, {5})", entry.EntryNameHash, entry.DataOffset, entry.DataType, entry.Unknown_9h, entry.ReferenceTypeIndex, entry.ReferenceKey); if (i < def.Entries.Count - 1) { sb.Append(",\n"); } else { sb.Append("\n"); } } sb.Append("\t\t\t\t\t});\n"); sb.AppendLine(); return(sb.ToString()); }
public Result <LoadIncrementalState> Correct( LoadState state , LoadIncrementalState prediction , StructureInfo info , Vector <double> dut , Vector <double> dur) => new Result <LoadIncrementalState>() { Value = new LoadIncrementalState(0, dur) };
private static MetaStructure MakeStructureWithComplexReferencedData() { var structureWithComplexReferenceDataInfo = new StructureInfo(); var structureWithComplexReferenceData = new MetaStructure(null, structureWithComplexReferenceDataInfo); structureWithComplexReferenceData.Values = new Dictionary <int, IMetaValue>(); structureWithComplexReferenceData.Values.Add(unchecked ((int)0x6F004ECC), MakeStructureArray()); structureWithComplexReferenceData.Values.Add(unchecked ((int)0x8F3E7BA7), MakeStructurePointerArray()); return(structureWithComplexReferenceData); }
private void AddChildNodesRecursive(StructureInfo info, TreeNode node) { foreach (var childInfo in info.Childs) { var childNode = new TreeNode(childInfo.Name); childNode.Tag = childInfo; node.Nodes.Add(childNode); AddChildNodesRecursive(childInfo, childNode); } }
public void RegisterPendingStructure(StructureInfo info, StructureContext context) { if (info == null || context == null) { return; } lock (pendingStructureMutex) { { bool alreadyThere = false; // Do not register the same thing twice for (int i = 0; i < pendingStructureInfo.Count; i++) { if (pendingStructureInfo[i].Equals(info)) { alreadyThere = true; break; } } if (!alreadyThere) { pendingStructureInfo.Add(info); } } List <StructureContext> list; if (pendingStructures.TryGetValue(context.chunkPos, out list)) { list.Add(context); } else { pendingStructures.Add(context.chunkPos, new List <StructureContext> { context }); } } { Chunk chunk; lock (chunks) { // Let the chunk know it needs an update if it exists chunk = GetChunk(ref context.chunkPos); } if (chunk != null) { chunk.NeedApplyStructure = true; } } }
public override void Encrypt(IJTTPackageInfo packageInfo, byte[] buffer, StructureInfo structure) { try { throw new NotImplementedException("还未实现RSA加密."); } catch (Exception ex) { throw new JTTException($"加密时发生错误, structureId: {structure.Id}.", ex); } }
/// <summary> /// Create root of configuration structure. /// </summary> /// <param name="structure">Info about configuration structure.</param> /// <returns>Configuration structure root.</returns> internal static ConfigRoot CreateConfigRoot(StructureInfo structure) { var configRoot = createConfigRootRaw(structure); foreach (var section in structure.Sections) { var configSection = createConfigSection(section); configRoot.InsertSection(configSection); } return(configRoot); }
public override void Encrypt(IJTTPackageInfo packageInfo, byte[] buffer, StructureInfo structure) { try { //无需加密 return; } catch (Exception ex) { throw new JTTException($"加密时发生错误, structureId: {structure.Id}.", ex); } }
public LoadIncrementalState SelectDisplacement( StructureInfo info , LoadState state , LoadIncrementalState prediction , IEnumerable <LoadIncrementalState> candidates) { double Function(LoadIncrementalState candidate) => prediction.IncrementDisplacement.DotProduct(candidate.IncrementDisplacement) / (prediction.IncrementDisplacement.Norm(2) * candidate.IncrementDisplacement.Norm(2)); return(candidates.MinBy(Function).First()); }
private void SetupGeneric() { //this stuff happens for blueprint structures and real structures //static SetThingStructurePairs(); structureControllerCount++; matchingThingType = thingAndStructurePairs [structureType]; matchingThing = ThingFactory.MakeThing(matchingThingType); structureInfo = new StructureInfo(matchingThingType); }
IEnumerable <double> GetErrors(LoadState newState, LoadState oldState, StructureInfo info) { Vector <double> reaction = info.Reaction(newState.Displacement); Vector <double> equilibrium = info.InitialLoad + newState.Lambda * info.ReferenceLoad - reaction; Vector <double> incrementDisplacement = newState.Displacement - oldState.Displacement; yield return(incrementDisplacement.Norm(2) / newState.Displacement.Norm(2)); yield return(equilibrium.Norm(2) / info.ReferenceLoad.Norm(2)); yield return(Math.Abs(newState.Displacement.DotProduct(equilibrium) / newState.Displacement.DotProduct(info.ReferenceLoad))); }
public static StructureInfo GetStructureInfo(MetaFile meta, int structureKey) { StructureInfo info = null; foreach (var x in meta.StructureInfos) { if (x.StructureNameHash == structureKey) { info = x; } } return(info); }
public static EnumInfo GetEnumInfo(MetaFile meta, int structureKey) { EnumInfo info = null; foreach (var x in meta.EnumInfos) { if (x.EnumNameHash == structureKey) { info = x; } } return(info); }
public void LoadSceneObjects() { //getting resources GameManager.instance.setResources(PlayerPrefs.GetInt("Resource0"), PlayerPrefs.GetInt("Resource1"), PlayerPrefs.GetInt("Resource2")); DeleteAll("StructureTile"); StructureData[] data = SaveSystem.LoadStructures().data; foreach (StructureData structure in data) { //print ("name " + structure.name); Vector2 structurePosition = new Vector2(structure.position[0], structure.position[1]); // GameObject go = GameObject.Find("SceneManager"); ObjectPairList other = this.GetComponent(typeof(ObjectPairList)) as ObjectPairList; string nameToReturn = structure.name; GameObject loadedObject; //Debug.Log (nameToReturn); if (nameToReturn.EndsWith("(Clone)")) { //Debug.Log(nameToReturn.Split('(')[0].Trim()); loadedObject = other.returnGameObject(nameToReturn.Split('(') [0].Trim()); } else { loadedObject = other.returnGameObject(nameToReturn); } //Modified if (structure.duration > 0) { loadedObject = other.returnGameObject("ConstructionSite"); } GameObject instantiatedObject = Instantiate(loadedObject, structurePosition, Quaternion.identity); StructureInfo script = instantiatedObject.GetComponent <StructureInfo> (); script.X = (int)structurePosition.x; script.Y = (int)structurePosition.y; script.Name = structure.name; script.Level = structure.level; script.Duration = structure.duration; } GameManager.instance.Invoke("updateStructureState", 0.1f); //ship part ShipsBuildingData allShips = SaveSystem.LoadShips(); GameManager.instance.setShipsInProgress(allShips.shipsInProgress); GameManager.instance.setFinishedShips(allShips.finishedShips); }
/// <summary> /// Collect all default values from given structure info. /// </summary> /// <param name="structureInfo">Structure info, which default values we want to obtain.</param> /// <returns>All option values with default value.</returns> private static IEnumerable <OptionValue> getDefaults(StructureInfo structureInfo) { foreach (var section in structureInfo.Sections) { foreach (var option in section.Options) { if (option.DefaultValue == null) { continue; } yield return(new OptionValue(option.Name, option.DefaultValue)); } } }
public static MetaStructure MakeDataset() { var valueInfo = new StructureInfo(); valueInfo.StructureNameHash = 0x22DD6F04; var rootStructure = new MetaStructure(null, valueInfo); rootStructure.Values = new Dictionary <int, IMetaValue>(); rootStructure.Values.Add(unchecked ((int)0x38C62F77), MakeStructureWithSimpleData()); rootStructure.Values.Add(unchecked ((int)0x97CC848A), MakeStructureWithEnumData()); rootStructure.Values.Add(0x3A5B9F33, MakeStructureWithSimpleReferencedData()); rootStructure.Values.Add(0x53663957, MakeStructureWithComplexReferencedData()); return(rootStructure); }
private void InstanceOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { if (propertyChangedEventArgs.PropertyName == nameof(Domain.SelectedStructureInfo)) { if (lastStructureInfo != null) { lastStructureInfo.PropertyChanged -= SelectedStructureInfoOnPropertyChanged; } Domain.Instance.SelectedStructureInfo.PropertyChanged += SelectedStructureInfoOnPropertyChanged; lastStructureInfo = Domain.Instance.SelectedStructureInfo; RefreshData(); } }
public override void Encrypt(IJTTPackageInfo packageInfo, byte[] buffer, StructureInfo structure) { try { if (protocol.Encrypt.Targets?.ContainsKey(structure.Id) != true) { return; } var encryptProperty = protocol.Encrypt.Targets[structure.Id]; if (!(bool)packageInfo.GetPropertyValue(encryptProperty.Flag.Split('.'))) { return; } //生成Key var key_bytes = new byte[4]; new Random().NextBytes(key_bytes); var key = BitConverter.ToUInt32(key_bytes); //写入Key packageInfo.SetValueToProperty(encryptProperty.Key.Split('.'), key); using MemoryStream ms_encrypt = new MemoryStream(); var writer = new BinaryWriter(ms_encrypt); using (MemoryStream ms = new MemoryStream(buffer)) { var reader = new BinaryReader(ms); while (ms.Position < ms.Length) { var @char = reader.ReadChar(); //将待传输的数据与伪随机码按字节进行异或运算 key = protocol.Encrypt.IA1 * (key % protocol.Encrypt.M1) + protocol.Encrypt.IC1; @char ^= (Char)((key >> 20) & 0xff); //写入加密的数据 writer.Write(@char); } } buffer = ms_encrypt.ToArray(); } catch (Exception ex) { throw new JTTException($"加密时发生错误, structureId: {structure.Id}.", ex); } }
public static string GenerateStructureChildInfoDefiniton(StructureInfo si, List <int> nameHashes) { var sb = new StringBuilder(); sb.AppendFormat("\t\t\t\tcase {0}: {{\n", GetMetaNameString(si.StructureNameHash)); for (int i = 0; i < nameHashes.Count; i++) { sb.AppendFormat("\t\t\t\t\tstructureInfos.Add(MetaInfo.GetStructureInfo({0}));\n", GetMetaNameString(nameHashes[i])); } sb.AppendLine("\t\t\t\t\tbreak;"); sb.AppendLine("\t\t\t\t}"); return(sb.ToString()); }
private static MetaStructure MakeStructureWithSimpleData() { var structureWithSimpleTypesInfo = new StructureInfo(); var structureWithSimpleTypes = new MetaStructure(null, structureWithSimpleTypesInfo); structureWithSimpleTypes.Values = new Dictionary <int, IMetaValue>(); structureWithSimpleTypes.Values.Add(unchecked ((int)0x36C55540), new MetaBoolean(false)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x707975FF), new MetaBoolean(true)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x96142337), new MetaByte_A(-128)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xD4D9059D), new MetaByte_A(-127)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x710D0955), new MetaByte_A(126)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x860ACDD8), new MetaByte_A(127)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xCDFD7789), new MetaByte_B(0)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x7DCCF225), new MetaByte_B(1)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xA0AB9B78), new MetaByte_B(254)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x3A223898), new MetaByte_B(255)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x2F07F270), new MetaInt16_A(-32768)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x83E5053E), new MetaInt16_A(-32767)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x86F3BC1E), new MetaInt16_A(32766)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x2C916F02), new MetaInt16_A(32767)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x1972DD39), new MetaInt16_B(0)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x1433E9A2), new MetaInt16_B(1)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xABF22E97), new MetaInt16_B(65534)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xCAD920FA), new MetaInt16_B(65535)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x96AA9C22), new MetaInt32_A(-2147483648)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xBE498F77), new MetaInt32_A(-2147483647)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xDEA66123), new MetaInt32_A(2147483646)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xA7A347FE), new MetaInt32_A(2147483647)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x5940A2C4), new MetaInt32_B(0)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x7AE8E34B), new MetaInt32_B(1)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x48758F24), new MetaInt32_B(4294967294)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x2DCCF53B), new MetaInt32_B(4294967295)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x7C6BAA24), new MetaFloat(1.2f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xC81C39E6), new MetaFloat(12.0f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xC599B2B0), new MetaFloat4_XYZ(1.2f, 3.4f, 5.6f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xA2B4F045), new MetaFloat4_XYZ(12.0f, 34.0f, 56.0f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xE0B18333), new MetaFloat4_XYZW(1.2f, 3.4f, 5.6f, 7.8f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0xA7E3D660), new MetaFloat4_XYZW(12.0f, 34.0f, 56.0f, 78.0f)); structureWithSimpleTypes.Values.Add(unchecked ((int)0x3B8AF0C2), new MetaArrayOfBytes(new byte[] { 0, 1, 254, 255 })); var charinfo = new StructureEntryInfo(); charinfo.ReferenceKey = 64; structureWithSimpleTypes.Values.Add(unchecked ((int)0x8FF34AB5), new MetaArrayOfChars(charinfo, "A String")); structureWithSimpleTypes.Values.Add(unchecked ((int)0x17525AB1), new MetaInt32_Hash(unchecked ((int)0xF63A8BC0))); structureWithSimpleTypes.Values.Add(unchecked ((int)0x10D59C62), new MetaInt32_Hash(0)); return(structureWithSimpleTypes); }
private void spawnObject() { ObjectPairList objPairList = GameObject.Find("SceneManager").GetComponent(typeof(ObjectPairList)) as ObjectPairList; StructureInfo constructionInfo = this.GetComponent <StructureInfo> (); //Debug.Log("script.Name:" + script.Name + ";;" + script.name); GameObject loadedObject = objPairList.returnGameObject(constructionInfo.Name); Vector2 structurePosition = new Vector2(constructionInfo.X, constructionInfo.Y); //Debug.Log("loadedObject:" + loadedObject.name); GameObject instantiatedObject = Instantiate(loadedObject, structurePosition, Quaternion.identity); StructureInfo structureInfo = instantiatedObject.GetComponent <StructureInfo> (); structureInfo.X = (int)structurePosition.x; structureInfo.Y = (int)structurePosition.y; //script.name = structure.name; structureInfo.Level = constructionInfo.Level; Destroy(gameObject); GameManager.instance.Invoke("updateStructureState", 1f); }
public LoadIncrementalState SelectDisplacement( StructureInfo info , LoadState state , LoadIncrementalState prediction , IEnumerable <LoadIncrementalState> candidates) { double Function(LoadIncrementalState candidate) { Vector <double> displacement = state.Displacement + candidate.IncrementDisplacement; Vector <double> reaction = info.Reaction(displacement); double lambda = state.Lambda + candidate.IncrementLambda; Vector <double> equilibriumVector = info.InitialLoad + lambda * info.ReferenceLoad - reaction; return(equilibriumVector.Norm(2)); } return(candidates.MinBy(Function).First()); }
private static MetaStructure MakeStructureWithSimpleReferencedData() { var structureWithSimpleReferenceDataInfo = new StructureInfo(); var structureWithSimpleReferenceData = new MetaStructure(null, structureWithSimpleReferenceDataInfo); structureWithSimpleReferenceData.Values = new Dictionary <int, IMetaValue>(); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0xEF099C3A), MakeCharArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x79FE4E42), MakeShortArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x62AFD2A7), MakeIntArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x8FD208FE), MakeFloatArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0xD094EFE2), MakeFloatVectorArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x68B43521), MakeHashArray()); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x3A6E4591), new MetaCharPointer("A String")); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0xC9811541), new MetaCharPointer(null)); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0xC8C01542), new MetaDataBlockPointer(null, new byte[] { 0, 1, 254, 255 })); structureWithSimpleReferenceData.Values.Add(unchecked ((int)0x2FCAB965), new MetaDataBlockPointer(null, null)); return(structureWithSimpleReferenceData); }
private static MetaStructure MakeStructureWithEnumData() { var structureWithEnumsInfo = new StructureInfo(); var structureWithEnums = new MetaStructure(null, structureWithEnumsInfo); structureWithEnums.Values = new Dictionary <int, IMetaValue>(); structureWithEnums.Values.Add(unchecked ((int)0x2300AF3B), MakeByteEnum()); structureWithEnums.Values.Add(unchecked ((int)0x56E94C50), MakeIntEnumA()); structureWithEnums.Values.Add(unchecked ((int)0x43F0EEF4), MakeIntEnumB()); structureWithEnums.Values.Add(unchecked ((int)0xB4B7824B), MakeShortFlagsA()); structureWithEnums.Values.Add(unchecked ((int)0x1B3098A9), MakeShortFlagsB()); structureWithEnums.Values.Add(unchecked ((int)0xA51CF61E), MakeIntFlags1A()); structureWithEnums.Values.Add(unchecked ((int)0x11045D33), MakeIntFlags1B()); structureWithEnums.Values.Add(unchecked ((int)0xC66A7EC6), MakeIntFlags2A()); structureWithEnums.Values.Add(unchecked ((int)0x53C471C0), MakeIntFlags2B()); structureWithEnums.Values.Add(unchecked ((int)0x89D91A45), MakeIntFlags2C()); return(structureWithEnums); }
private void addBtn_Click(object sender, EventArgs e) { using (OpenFileDialog ofDlg = new OpenFileDialog() { Title = "Please select your structure file", DefaultExt = "lua" }) { ofDlg.ShowDialog(this); if (ofDlg.FileName.Length > 0) { string name = Path.GetFileNameWithoutExtension(ofDlg.FileName); StructureInfo newInfo = new StructureInfo() { Path = ofDlg.FileName, FileName = GuessName.Result(name, NameType.File), TableName = GuessName.Result(name, NameType.Table) }; structureBL.Add(newInfo); } } }
public StructureData(GameObject structure) { StructureInfo structureInfo = structure.GetComponent <StructureInfo>(); name = structureInfo.Name; if (structure.name.Contains("Construction")) { duration = structure.GetComponent <BuildProgressBar>().duration; name = structureInfo.Name; } else { duration = 0.0f; } level = structureInfo.Level; // structure.level; position = new float[2]; position[0] = structure.transform.position.x; position[1] = structure.transform.position.y; }
private static MetaArray MakeStructurePointerArray() { var metainf111 = new StructureInfo(); metainf111.StructureNameHash = 0x2D8B6A9C; MetaStructure metasubstr1 = new MetaStructure(null, metainf111); metasubstr1.Values = new Dictionary <int, IMetaValue>(); metasubstr1.Values.Add(unchecked ((int)0x04792618), new MetaBoolean(false)); metasubstr1.Values.Add(unchecked ((int)0xD302778A), new MetaBoolean(true)); MetaGeneric pointerValue1 = new MetaGeneric(); pointerValue1.Value = metasubstr1; var metainf222 = new StructureInfo(); metainf222.StructureNameHash = unchecked ((int)0xA71A1B09); MetaStructure metasubstr2 = new MetaStructure(null, metainf222); metasubstr2.Values = new Dictionary <int, IMetaValue>(); metasubstr2.Values.Add(unchecked ((int)0x8705BF6F), new MetaBoolean(true)); metasubstr2.Values.Add(unchecked ((int)0x981F3DBC), new MetaBoolean(false)); MetaGeneric pointerValue2 = new MetaGeneric(); pointerValue2.Value = metasubstr2; MetaGeneric pointerValue3 = new MetaGeneric(); pointerValue3.Value = null; MetaArray pointerArray = new MetaArray(); pointerArray.info = new StructureEntryInfo(); pointerArray.info.DataType = StructureEntryDataType.Structure; pointerArray.Entries = new List <IMetaValue>(); pointerArray.Entries.Add(pointerValue1); pointerArray.Entries.Add(pointerValue2); pointerArray.Entries.Add(pointerValue3); return(pointerArray); }
public PacketInfo(int opcode, string name, StructureInfo structure) { this.opcode = opcode; this.name = name; this.structure = structure; }
public ActionResult Index(SetupViewModel model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus = _membershipService.CreateUser(model.SetupModel.UserName, model.SetupModel.Password, model.SetupModel.Email); if (createStatus == MembershipCreateStatus.Success) { _formsService.SignIn(model.SetupModel.UserName, false /* createPersistentCookie */); // Create the site configuration IConfiguration configuration = new Configuration.Configuration(); configuration.SiteName = model.Configuration.SiteName; _session.Store(configuration); IStructureInfo structureInfo = new StructureInfo(); _session.Store(structureInfo); _session.SaveChanges(); return RedirectToAction("index", "UI", new { area = "ui" }); } ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus)); } // If we got this far, something failed, redisplay form return View(model); }