private JoinNode(ObjectData data) : base(data) { LeftColumnName = data.GetValue<ObjectName>("LeftColumn"); Operator = (SqlExpressionType) data.GetInt32("Operator"); RightExpression = data.GetValue<SqlExpression>("RightExpression"); }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/Prison Capsule.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Prison Capsule.asm", 0, 0); for (int i = 0; i < 2; i++) imgs.Add(ObjectHelper.MapASMToBmp(artfile, "../_maps/Prison Capsule.asm", i, 0)); }
private JoinPart(ObjectData data) { TableName = data.GetValue<ObjectName>("Table"); SubQuery = data.GetValue<SqlQueryExpression>("SubQuery"); JoinType = (JoinType) data.GetInt32("JoinType"); OnExpression = data.GetValue<SqlExpression>("On"); }
private SimpleSelectNode(ObjectData data) : base(data) { ColumnName = data.GetValue<ObjectName>("Column"); OperatorType = (SqlExpressionType) data.GetInt32("Operator"); Expression = data.GetValue<SqlExpression>("Expression"); }
private static ObjectData AddObject(JSONObject objJSON) { ObjectData obj = new ObjectData(); obj.objectType = objJSON["name"].str.ToLower(); obj.rotation = -objJSON["rotation"].f; if (objJSON["properties"]["waypoint"]) obj.waypointIndex = int.Parse(objJSON["properties"]["waypoint"].str); Vector4 values = new Vector4(objJSON["x"].f, objJSON["y"].f, objJSON["width"].f, objJSON["height"].f); values.x = values.x - Constants.SCREEN_WIDTH_BY_PIXEL / 2; values.y = Constants.SCREEN_HEIGHT_BY_PIXEL - values.y - Constants.SCREEN_HEIGHT_BY_PIXEL / 2; float alpha = obj.rotation * Mathf.Deg2Rad - Mathf.Atan2(values.w, values.z); float h = Mathf.Sqrt(values.z * values.z + values.w * values.w) / 2; values.x += Mathf.Cos(alpha) * h; values.y += Mathf.Sin(alpha) * h; values *= Constants.FACTOR_PIXEL_TO_METER; obj.position = new Vector2(values.x, values.y); obj.size = new Vector2(values.z, values.w); return obj; }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/GHZ Swinging Platform.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Swinging Platforms (GHZ).asm", 0, 2); for (int i = 0; i < labels.Length; i++) imgs.Add(ObjectHelper.MapASMToBmp(artfile, "../_maps/Swinging Platforms (GHZ).asm", labels[i], i == 1 ? 1 : 2)); }
private FromTable(ObjectData data) { Name = data.GetString("Name"); SubQuery = data.GetValue<SqlQueryExpression>("SubQuery"); Alias = data.GetString("Alias"); IsSubQuery = data.HasValue("SubQuery"); }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/Enemy Newtron.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Newtron.asm", 3, 0); for (int i = 0; i < labels.Length; i++) imgs.Add(ObjectHelper.MapASMToBmp(artfile, "../_maps/Newtron.asm", labels[i], i)); }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/GHZ Breakable Wall.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Smashable Walls.asm", 0, 2); for (int i = 0; i < labels.Length; i++) imgs.Add(ObjectHelper.MapASMToBmp(artfile, "../_maps/Smashable Walls.asm", labels[i], 2)); }
protected override void ReadVerbTable(ObjectData data, int size) { var pos = _reader.BaseStream.Position - 8; int id; do { id = _reader.ReadInt32(); if (id != 0) { var offset = _reader.ReadInt32(); if (!data.ScriptOffsets.ContainsKey(id)) { data.ScriptOffsets.Add(id, offset); } } } while(id != 0); var realCodeOffset = _reader.BaseStream.Position - pos; var virtualCodeOffset = (8 * data.ScriptOffsets.Count + 4 + 8); var diff = (int)(realCodeOffset - virtualCodeOffset); foreach (var key in data.ScriptOffsets.Keys.ToList()) { data.ScriptOffsets[key] -= diff; } data.Script.Offset = virtualCodeOffset - 8; }
private SqlConditionalExpression(ObjectData data) : base(data) { TestExpression = data.GetValue<SqlExpression>("Test"); TrueExpression = data.GetValue<SqlExpression>("True"); FalseExpression = data.GetValue<SqlExpression>("False"); }
public override void Init(ObjectData data) { img = ObjectHelper.UnknownObject; List<Sprite> sprs = new List<Sprite>(); int left = -208; int right = 208; int top = 0; int bottom = 0; for (int i = 0; i < Obj06_CosineTable.Length; i++) { top = Math.Min(Obj06_CosineTable[i], top); bottom = Math.Max(Obj06_CosineTable[i], bottom); } Point offset = new Point(left, top); BitmapBits bmp = new BitmapBits(right - left, bottom - top); for (int x = 0; x < 0x1A0; x++) { int y = Obj06_CosineTable[x] - top; if (x < bmp.Width & y >= 0 & y < bmp.Height) bmp[x, y] = 0x1C; } sprs.Add(new Sprite(bmp, offset)); offset = new Point(-192, 0); bmp = new BitmapBits(0x180, 53); bmp.DrawLine(0x1C, 192, 0, 192, 52); bmp.DrawLine(0x1C, 0, 52, 0x180, 52); sprs.Add(new Sprite(bmp, offset)); sprs.Add(img); sprite = new Sprite(sprs.ToArray()); }
private SqlBinaryExpression(ObjectData data) : base(data) { Left = data.GetValue<SqlExpression>("Left"); Right = data.GetValue<SqlExpression>("Right"); expressionType = (SqlExpressionType) data.GetInt32("ExpressionType"); }
private QueryParameter(ObjectData data) { Name = data.GetString("Name"); SqlType = data.GetValue<SqlType>("Type"); Value = data.GetValue<Objects.ISqlObject>("Value"); Direction = (QueryParameterDirection) data.GetInt32("Direction"); }
private ColumnInfo(ObjectData data) { ColumnName = data.GetString("ColumnName"); ColumnType = data.GetValue<SqlType>("ColumnType"); IsNotNull = data.GetBoolean("IsNotNull"); DefaultExpression = data.GetValue<SqlExpression>("Default"); IndexType = data.GetString("IndexType"); }
private SqlTableColumn(ObjectData data) { ColumnName = data.GetString("ColumnName"); ColumnType = data.GetValue<SqlType>("ColumnType"); IsIdentity = data.GetBoolean("IsIdentity"); IsNotNull = data.GetBoolean("IsNotNull"); DefaultExpression = data.GetValue<SqlExpression>("Default"); }
private GroupNode(ObjectData data) : base(data) { ColumnNames = data.GetValue<ObjectName[]>("Columns"); GroupMaxColumn = data.GetValue<ObjectName>("GroupMax"); Functions = data.GetValue<SqlExpression[]>("Functions"); Names = data.GetValue<string[]>("Names"); }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/Hidden Bonuses.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Hidden Bonuses.asm", 3, 0); imgs.Add(ObjectHelper.UnknownObject); for (int i = 0; i < labels.Length; i++) imgs.Add(ObjectHelper.MapASMToBmp(artfile, "../_maps/Hidden Bonuses.asm", labels[i], 0)); }
private GrantPrivilegesStatement(ObjectData data) { ObjectName = data.GetValue<ObjectName>("ObjectName"); Grantee = data.GetString("Grantee"); Privilege = (Privileges) data.GetInt32("Privilege"); Columns = data.GetValue<string[]>("Columns"); WithGrant = data.GetBoolean("WithGrant"); }
public bool TryGet(string avatar_prim_uuid, out ObjectData data) { if (avatarCollection.TryGet(avatar_prim_uuid, out data)) return true; if (primCollection.TryGet(avatar_prim_uuid, out data)) return true; return false; }
private DeclareCursorStatement(ObjectData data) { CursorName = data.GetString("CursorName"); QueryExpression = data.GetValue<SqlQueryExpression>("QueryExpression"); Flags = (CursorFlags) data.GetInt32("Flags"); if (data.HasValue("Parameters")) { var parameters = data.GetValue<CursorParameter[]>("Parameters"); Parameters = new List<CursorParameter>(parameters); } }
private SqlTableConstraint(ObjectData data) { ConstraintName = data.GetString("Name"); ConstraintType = (ConstraintType) data.GetInt32("Type"); Columns = data.GetValue<string[]>("Columns"); CheckExpression = data.GetValue<SqlExpression>("Check"); ReferenceTable = data.GetString("ReferenceTable"); ReferenceColumns = data.GetValue<string[]>("ReferenceColumns"); OnDelete = (ForeignKeyAction) data.GetInt32("OnDelete"); OnUpdate = (ForeignKeyAction) data.GetInt32("OnUpdate"); }
private StringType(ObjectData data) : base(data) { MaxSize = data.GetInt32("MaxSize"); if (data.HasValue("Locale")) { var locale = data.GetString("Locale"); Locale = new CultureInfo(locale); } if (data.HasValue("Encoding")) { var encoding = data.GetString("Encoding"); Encoding = Encoding.GetEncoding(encoding); } }
public void PushObject(string name) { //Debug.Log("Adding new object " + name + ". Current is empty: " + isEmpty); if(isEmpty) objects.Remove(current); ObjectData n = new ObjectData(); n.name = name; objects.Add(n); GroupData g = new GroupData(); g.name = "default"; n.groups.Add(g); curgr = g; current = n; }
public override void Init(ObjectData data) { if (data.Art != null) { MultiFileIndexer<byte> art = new MultiFileIndexer<byte>(); foreach (FileInfo file in data.Art) art.AddFile(new List<byte>(ObjectHelper.OpenArtFile(file.Filename, data.ArtCompression)), file.Offset); byte[] artfile = art.ToArray(); if (data.MapFile != null) { if (data.DPLCFile != null) spr = ObjectHelper.MapDPLCToBmp(artfile, ObjectHelper.OpenArtFile(data.MapFile, data.MapCompression), data.MapVersion, ObjectHelper.OpenArtFile(data.DPLCFile, data.DPLCCompression), data.MapVersion, data.Frame, data.Palette); else spr = ObjectHelper.MapToBmp(artfile, ObjectHelper.OpenArtFile(data.MapFile, data.MapCompression), data.Frame, data.Palette, data.MapVersion); } else if (data.MapFileAsm != null) { if (data.MapAsmLabel != null) { if (data.DPLCFileAsm != null) spr = ObjectHelper.MapASMDPLCToBmp(artfile, data.MapFileAsm, data.MapAsmLabel, data.MapVersion, data.DPLCFileAsm, data.DPLCAsmLabel, data.MapVersion, data.Palette); else spr = ObjectHelper.MapASMToBmp(artfile, data.MapFileAsm, data.MapAsmLabel, data.Palette, data.MapVersion); } else { if (data.DPLCFileAsm != null) spr = ObjectHelper.MapASMDPLCToBmp(artfile, data.MapFileAsm, data.MapVersion, data.DPLCFileAsm, data.MapVersion, data.Frame, data.Palette); else spr = ObjectHelper.MapASMToBmp(artfile, data.MapFileAsm, data.Frame, data.Palette, data.MapVersion); } } else spr = ObjectHelper.UnknownObject; if (data.Offset != Size.Empty) spr.Offset = spr.Offset + data.Offset; } else if (data.Image != null) { BitmapBits img = new BitmapBits(new Bitmap(data.Image)); spr = new Sprite(img, new Point(data.Offset)); } else if (data.Sprite > -1) spr = ObjectHelper.GetSprite(data.Sprite); else spr = ObjectHelper.UnknownObject; spacing = int.Parse(data.CustomProperties.GetValueOrDefault("spacing", "24"), System.Globalization.NumberStyles.Integer, System.Globalization.NumberFormatInfo.InvariantInfo); }
public GeometryBuffer() { objects = new List<ObjectData>(); ObjectData d = new ObjectData(); d.name = "default"; objects.Add(d); current = d; GroupData g = new GroupData(); g.name = "default"; d.groups.Add(g); curgr = g; vertices = new List<Vector3>(); uvs = new List<Vector2>(); normals = new List<Vector3>(); }
private FromClause(ObjectData data) { var tableNames = data.GetValue<string[]>("TableNames"); var fromTables = data.GetValue<FromTable[]>("FromTables"); var joinParts = data.GetValue<JoinPart[]>("JoinParts"); this.tableNames = new List<string>(); this.fromTables = new List<FromTable>(); this.joinParts = new List<JoinPart>(); if (tableNames != null) this.tableNames.AddRange(tableNames); if (fromTables != null) this.fromTables.AddRange(fromTables); if (joinParts != null) this.joinParts.AddRange(joinParts); }
public void RememberAll() { Datas = new List<ObjectData>(); foreach (GameObject o in DynamicObjects) { ObjectData data = new ObjectData(); data.position = o.transform.position; data.rotation = o.transform.rotation; data.isKinect = o.rigidbody2D.isKinematic; data.velocity = o.rigidbody2D.velocity; data.angularVelocity = o.rigidbody2D.angularVelocity; Datas.Add(data); } Debug.Log ("Remember?"); }
public GeometryBuffer() { _objects = new List<ObjectData>(); ObjectData d = new ObjectData(); d.Name = "default"; _objects.Add(d); _current = d; GroupData g = new GroupData(); g.Name = "default"; d.Groups.Add(g); _curgr = g; Vertices = new List<Vector3>(); Uvs = new List<Vector2>(); Normals = new List<Vector3>(); }
public GeometryBuffer() { objects = new List<ObjectData>(); ObjectData d = new ObjectData(); d.name = "default"; objects.Add(d); current = d; GroupData g = new GroupData(); g.name = "default"; // OBJ.cs ALTERATION3: added to help with missing material libraries see g.materialName = "default"; d.groups.Add(g); curgr = g; vertices = new List<Vector3>(); uvs = new List<Vector2>(); normals = new List<Vector3>(); }
/// <summary> /// Export Entry to stream /// </summary> /// <param name="BW"></param> /// <remarks>Not the <see cref="Properties"/> as this is done later</remarks> public void Export(BinaryWriter BW) { BW.Write(EntryType); ObjectData.Export(BW); }
public void ShowResultPanel(ObjectData mmo) { panelManager.ShowPanel("result"); resultDisplay.Present(mmo); }
public void Load() { tileData = GameManager.manager.saveManager.SaveData.worldData.tileData; worldSize = GameManager.manager.worldSettings.size; worldOrigin = new Vector3Int(); worldOrigin.x = (int)(worldSize.x * -0.5f); worldOrigin.y = (int)(worldSize.y * -0.5f); int xSize = (int)worldSize.x; int ySize = (int)worldSize.y; objects = new SaveableObject[xSize, ySize]; utilityObjects = new SaveableObject[xSize, ySize]; for (int x = 0; x < xSize; x++) { for (int y = 0; y < ySize; y++) { Vector3Int pos = new Vector3Int(worldOrigin.x + x, worldOrigin.y + y, 0); if (tileData.tileTypes[x, y, 0] >= 0) { SetTile(pos, 0, tileData.tileTypes[x, y, 0], 0, false, false); } if (tileData.tileTypes[x, y, 1] >= 0) { SetTile(pos, 1, tileData.tileTypes[x, y, 1], 0, false, false); DamageWall(pos, 0); } if (tileData.tileTypes[x, y, 2] >= 0) { SetTile(pos, 2, tileData.tileTypes[x, y, 2], 0, false, false); } if (tileData.tileTypes[x, y, 3] >= 0) { SetTile(pos, 3, tileData.tileTypes[x, y, 3], 0, false, false); } if (tileData.tileTypes[x, y, 5] >= 0) { SetTile(pos, 5, tileData.tileTypes[x, y, 5], 0, true, false); } } } List <Data> datas = tileData.objects; foreach (Data data in datas) { System.Type type; ObjectData dataToUse = data.Load(out type); Vector3Int pos = Vector3Int.FloorToInt(dataToUse.position) - worldOrigin; if (dataToUse.useUtilityList) { utilityObjects[pos.x, pos.y].GetComponent <SaveableObject>().Load(dataToUse); } else { objects[pos.x, pos.y].GetComponent <SaveableObject>().Load(dataToUse); } } //Load zones foreach (Zone zone in tileData.zones) { List <Vector3Int> tiles = zone.tiles.ConvertAll(x => Vector3Int.RoundToInt(x)); AddToZone(tiles, zone.type); } availableTasks = tileData.tasks.ConvertAll(x => (Task)x); waterToSimulate = tileData.waterToSimulate.ConvertAll(x => Vector3Int.RoundToInt(x)); }
public override void FillSlot(ObjectData objectData, int amount) { base.FillSlot(objectData, amount); EnableBackground(true); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("Objects/Levels/Emerald Coast/O ROCK2.sa1mdl"); meshes = ObjectHelper.GetMeshes(model); }
public override void Init(ObjectData data) { BuildSpritesSubtypes(7, false, "../Levels/LBZ/Tiles/Act 2 Death Egg 2.bin"); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("Objects/Levels/Windy Valley/Sirusi5.sa1mdl"); meshes = ObjectHelper.GetMeshes(model); }
public override void Init(ObjectData data, string name, Device dev) { model = ObjectHelper.LoadModel("Objects/Common/O AXPNL.sa1mdl"); meshes = ObjectHelper.GetMeshes(model, dev); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("stg02_windy/common/models/windobj_hasib_end.nja.sa1mdl"); meshes = ObjectHelper.GetMeshes(model); }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/rings.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/obj25.asm", 0, 1); }
private DropCallbackTriggersStatement(ObjectData data) : base(data) { TableName = data.GetValue <ObjectName>("TableName"); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("nondisp/cube01.nja.sa1mdl"); meshes = ObjectHelper.GetMeshes(model); }
public void SetCode(ObjectData data, bool isFoldable) { Debug.Assert(_methodCode == null); _methodCode = data; _isFoldable = isFoldable; }
public PrimitiveObjectTreeItem(object value, ObjectTreeItem parent, string propertyName, ObjectData source) : base(parent, propertyName, source) { Value = value; }
public override void Init(ObjectData data) { BuildSpritesSubtypes(1, false); }
private DropSchemaStatement(ObjectData data) { SchemaName = data.GetString("SchemaName"); }
public void MeshSwitch() { if (camControl == null) { camControl = FindObjectOfType <CameraController>(); } GameObject currentGO = camControl.selectedObj.gameObject; ObjectData currentData = currentGO.GetComponent <ObjectData>(); TMPro.TMP_Text buttonName = GetComponentInChildren <TMPro.TMP_Text>(); if (CompareTag("Kitchen")) { foreach (GameObject sink in currentData.sinkOptions) { if (buttonName.text == sink.name) { sink.SetActive(true); } else { sink.SetActive(false); } } } if (CompareTag("Door")) { foreach (GameObject door in currentData.doorOptions) { if (buttonName.text == door.name) { door.SetActive(true); } else { door.SetActive(false); } } } if (CompareTag("Drawer")) { foreach (GameObject drawer in currentData.drawerOptions) { if (buttonName.text == drawer.name) { drawer.SetActive(true); } else { drawer.SetActive(false); } } } if (CompareTag("ApplianceOpt")) { foreach (GameObject washer in currentData.applianceOptions) { if (buttonName.text == washer.name) { washer.SetActive(true); } else { washer.SetActive(false); } } } }
internal static ObjectData MakeObjectData(InventoryItem item, int slot) { QuickLogger.Debug($"In Make Object"); var go = item?.item?.gameObject; if (go == null) { return new ObjectData { DataObjectType = SaveDataObjectType.Item, TechType = TechType.None } } ; QuickLogger.Debug($"GameObject {go}"); var objectType = FindSaveDataObjectType(go); QuickLogger.Debug($"Object Type {objectType}"); var techType = item.item.GetTechType(); QuickLogger.Debug($"Object Tech Type {techType}"); ObjectData result; switch (objectType) { case SaveDataObjectType.Item: result = new ObjectData { DataObjectType = objectType, TechType = item.item.GetTechType() }; break; case SaveDataObjectType.PlayerTool: result = new ObjectData { DataObjectType = objectType, TechType = techType, PlayToolData = GetPlayerToolData(item) }; break; case SaveDataObjectType.Eatable: result = new ObjectData { DataObjectType = objectType, TechType = techType, EatableEntity = GetEatableData(item) }; break; case SaveDataObjectType.Server: result = new ObjectData { DataObjectType = objectType, TechType = techType, ServerData = GetServerData(item) }; break; case SaveDataObjectType.Battery: result = new ObjectData { DataObjectType = objectType, TechType = techType, PlayToolData = GetBatteryData(item) }; break; default: throw new ArgumentOutOfRangeException(); } return(result); }
public void UpdateMaterial() { if (camControl == null) { camControl = FindObjectOfType <CameraController>(); } GameObject currentGO = camControl.selectedObj.gameObject; ObjectData currentData = currentGO.GetComponent <ObjectData>(); string currentTag = tag; Debug.Log("ObjectUpdater MaterialSwitch CurrentObject name: " + currentGO.name); Debug.Log("ObjectUpdater MaterialSwitch Debug tag: " + tag); List <GameObject> currentCollection = new List <GameObject>(); List <Material> currentOptions = new List <Material>(); TMPro.TMP_Text buttonName = GetComponentInChildren <TMPro.TMP_Text>(); switch (currentTag) { /*Get all granite objects in the scene. This is the only material section that * updates the material across all objects, as countertops are generally single slabs */ case "Granite": currentOptions = currentData.counterMat; List <GameObject> tempGranite = new List <GameObject>(GameObject.FindGameObjectsWithTag("Granite")); foreach (var granite in tempGranite) { if (granite.GetComponent <ObjectUpdater>() == null) { currentCollection.Add(granite); } } break; case "Door": currentOptions = currentData.woodMat; foreach (var woodpart in currentData.doorOptions) { foreach (Transform child in woodpart.transform) { currentCollection.Add(child.gameObject); } } break; case "Drawer": currentOptions = currentData.woodMat; foreach (var woodPart in currentData.drawerOptions) { foreach (Transform child in woodPart.transform) { currentCollection.Add(child.gameObject); } } break; case "Wood": currentOptions = currentData.woodMat; foreach (var body in currentData.woodBase) { currentCollection.Add(body); } break; case "Pulls": currentOptions = currentData.accessoryMat; foreach (Transform child in currentData.pulls.transform) { currentCollection.Add(child.gameObject); } break; case "Knobs": currentOptions = currentData.accessoryMat; foreach (Transform child in currentData.knobs.transform) { currentCollection.Add(child.gameObject); } break; case "Accessory": // pulls and knobs // this search is necessary in case an object doesn't have its pulls and/or knobs set in the Inspector currentOptions = currentData.accessoryMat; if (currentData.pulls == null) { for (int i = 0; i < currentGO.transform.childCount; i++) { if (currentGO.transform.GetChild(i).gameObject.CompareTag("Pulls")) { currentData.pulls = currentGO.transform.GetChild(i).gameObject; } } } if (currentData.pulls != null) { foreach (Transform child in currentData.pulls.transform) { currentCollection.Add(child.gameObject); } } if (currentData.knobs == null) { for (int i = 0; i < currentGO.transform.childCount; i++) { if (currentGO.transform.GetChild(i).gameObject.CompareTag("Knobs")) { currentData.knobs = currentGO.transform.GetChild(i).gameObject; } } } if (currentData.knobs != null) { foreach (Transform child in currentData.knobs.transform) { currentCollection.Add(child.gameObject); } } break; default: // handle wood options. It seems that the untagged items all use wood. currentOptions = currentData.woodMat; foreach (var body in currentData.woodBase) { currentCollection.Add(body); } foreach (var woodpart in currentData.doorOptions) { foreach (Transform child in woodpart.transform) { currentCollection.Add(child.gameObject); } } foreach (var woodPart in currentData.drawerOptions) { foreach (Transform child in woodPart.transform) { currentCollection.Add(child.gameObject); } } //Debug.Log("Warning: Selected an object without a defined tag!"); break; } foreach (var currentObj in currentCollection) { Renderer adjustGO = currentObj.GetComponent <Renderer>(); if (adjustGO != null) { adjustGO.sharedMaterial = material; } } }
public override void Init(ObjectData data, string name, Device dev) { model = ObjectHelper.LoadModel("Objects/Levels/Windy Valley/O TATEL.sa1mdl"); meshes = ObjectHelper.GetMeshes(model, dev); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("mission/model/mi_target.nja.sa1mdl"); meshes = ObjectHelper.GetMeshes(model); }
/// <summary>Get the data to display for this subject.</summary> /// <param name="metadata">Provides metadata that's not available from the game data directly.</param> public override IEnumerable <ICustomField> GetData(Metadata metadata) { // get data Item item = this.Target; SObject obj = item as SObject; bool isObject = obj != null; bool isCrop = this.FromCrop != null; bool isSeed = this.SeedForCrop != null; bool isDeadCrop = this.FromCrop?.dead == true; bool canSell = obj?.canBeShipped() == true || metadata.Shops.Any(shop => shop.BuysCategories.Contains(item.category)); // get overrides bool showInventoryFields = true; { ObjectData objData = metadata.GetObject(item, this.Context); if (objData != null) { this.Name = objData.NameKey != null?this.Translate(objData.NameKey) : this.Name; this.Description = objData.DescriptionKey != null?this.Translate(objData.DescriptionKey) : this.Description; this.Type = objData.TypeKey != null?this.Translate(objData.TypeKey) : this.Type; showInventoryFields = objData.ShowInventoryFields ?? true; } } // don't show data for dead crop if (isDeadCrop) { yield return(new GenericField(this.Translate(L10n.Crop.Summary), this.Translate(L10n.Crop.SummaryDead))); yield break; } // crop fields if (isCrop || isSeed) { // get crop Crop crop = this.FromCrop ?? this.SeedForCrop; // get harvest schedule int harvestablePhase = crop.phaseDays.Count - 1; bool canHarvestNow = (crop.currentPhase >= harvestablePhase) && (!crop.fullyGrown || crop.dayOfCurrentPhase <= 0); int daysToFirstHarvest = crop.phaseDays.Take(crop.phaseDays.Count - 1).Sum(); // ignore harvestable phase // add next-harvest field if (isCrop) { // calculate next harvest int daysToNextHarvest = 0; SDate dayOfNextHarvest = null; if (!canHarvestNow) { // calculate days until next harvest int daysUntilLastPhase = daysToFirstHarvest - crop.dayOfCurrentPhase - crop.phaseDays.Take(crop.currentPhase).Sum(); { // growing: days until next harvest if (!crop.fullyGrown) { daysToNextHarvest = daysUntilLastPhase; } // regrowable crop harvested today else if (crop.dayOfCurrentPhase >= crop.regrowAfterHarvest) { daysToNextHarvest = crop.regrowAfterHarvest; } // regrowable crop else { daysToNextHarvest = crop.dayOfCurrentPhase; // dayOfCurrentPhase decreases to 0 when fully grown, where <=0 is harvestable } } dayOfNextHarvest = SDate.Now().AddDays(daysToNextHarvest); } // generate field string summary; if (canHarvestNow) { summary = this.Translate(L10n.Crop.HarvestNow); } else if (Game1.currentLocation.Name != Constant.LocationNames.Greenhouse && !crop.seasonsToGrowIn.Contains(dayOfNextHarvest.Season)) { summary = this.Translate(L10n.Crop.HarvestTooLate, new { date = this.Stringify(dayOfNextHarvest) }); } else { summary = $"{this.Stringify(dayOfNextHarvest)} ({this.Text.GetPlural(daysToNextHarvest, L10n.Generic.Tomorrow, L10n.Generic.InXDays).Tokens(new { count = daysToNextHarvest })})"; } yield return(new GenericField(this.Translate(L10n.Crop.Harvest), summary)); } // crop summary { List <string> summary = new List <string>(); // harvest summary.Add(crop.regrowAfterHarvest == -1 ? this.Translate(L10n.Crop.SummaryHarvestOnce, new { daysToFirstHarvest = daysToFirstHarvest }) : this.Translate(L10n.Crop.SummaryHarvestMulti, new { daysToFirstHarvest = daysToFirstHarvest, daysToNextHarvests = crop.regrowAfterHarvest }) ); // seasons summary.Add(this.Translate(L10n.Crop.SummarySeasons, new { seasons = string.Join(", ", this.Text.GetSeasonNames(crop.seasonsToGrowIn)) })); // drops if (crop.minHarvest != crop.maxHarvest && crop.chanceForExtraCrops > 0) { summary.Add(this.Translate(L10n.Crop.SummaryDropsXToY, new { min = crop.minHarvest, max = crop.maxHarvest, percent = Math.Round(crop.chanceForExtraCrops * 100, 2) })); } else if (crop.minHarvest > 1) { summary.Add(this.Translate(L10n.Crop.SummaryDropsX, new { count = crop.minHarvest })); } // crop sale price Item drop = GameHelper.GetObjectBySpriteIndex(crop.indexOfHarvest); summary.Add(this.Translate(L10n.Crop.SummarySellsFor, new { price = GenericField.GetSaleValueString(this.GetSaleValue(drop, false, metadata), 1, this.Text) })); // generate field yield return(new GenericField(this.Translate(L10n.Crop.Summary), "-" + string.Join($"{Environment.NewLine}-", summary))); } } // crafting if (obj?.heldObject != null) { if (obj is Cask cask) { // get cask data SObject agingObj = cask.heldObject; ItemQuality curQuality = (ItemQuality)agingObj.quality; string curQualityName = this.Translate(L10n.For(curQuality)); // calculate aging schedule float effectiveAge = metadata.Constants.CaskAgeSchedule.Values.Max() - cask.daysToMature; var schedule = ( from entry in metadata.Constants.CaskAgeSchedule let quality = entry.Key let baseDays = entry.Value where baseDays > effectiveAge orderby baseDays ascending let daysLeft = (int)Math.Ceiling((baseDays - effectiveAge) / cask.agingRate) select new { Quality = quality, DaysLeft = daysLeft, HarvestDate = SDate.Now().AddDays(daysLeft) } ) .ToArray(); // display fields yield return(new ItemIconField(this.Translate(L10n.Item.Contents), obj.heldObject)); if (cask.minutesUntilReady <= 0 || !schedule.Any()) { yield return(new GenericField(this.Translate(L10n.Item.CaskSchedule), this.Translate(L10n.Item.CaskScheduleNow, new { quality = curQualityName }))); } else { string scheduleStr = string.Join(Environment.NewLine, ( from entry in schedule let tokens = new { quality = this.Translate(L10n.For(entry.Quality)), count = entry.DaysLeft, date = entry.HarvestDate } let str = this.Text.GetPlural(entry.DaysLeft, L10n.Item.CaskScheduleTomorrow, L10n.Item.CaskScheduleInXDays).Tokens(tokens) select $"-{str}" )); yield return(new GenericField(this.Translate(L10n.Item.CaskSchedule), this.Translate(L10n.Item.CaskSchedulePartial, new { quality = curQualityName }) + Environment.NewLine + scheduleStr)); } } else if (obj is Furniture) { string summary = this.Translate(L10n.Item.ContentsPlaced, new { name = obj.heldObject.DisplayName }); yield return(new ItemIconField(this.Translate(L10n.Item.Contents), obj.heldObject, summary)); } else { string summary = obj.minutesUntilReady <= 0 ? this.Translate(L10n.Item.ContentsReady, new { name = obj.heldObject.DisplayName }) : this.Translate(L10n.Item.ContentsPartial, new { name = obj.heldObject.DisplayName, time = this.Stringify(TimeSpan.FromMinutes(obj.minutesUntilReady)) }); yield return(new ItemIconField(this.Translate(L10n.Item.Contents), obj.heldObject, summary)); } } // item if (showInventoryFields) { // needed for { List <string> neededFor = new List <string>(); // bundles if (isObject) { string[] bundles = (from bundle in this.GetUnfinishedBundles(obj) orderby bundle.Area, bundle.DisplayName select $"{this.GetTranslatedBundleArea(bundle)}: {bundle.DisplayName}").ToArray(); if (bundles.Any()) { neededFor.Add(this.Translate(L10n.Item.NeededForCommunityCenter, new { bundles = string.Join(", ", bundles) })); } } // polyculture achievement if (isObject && metadata.Constants.PolycultureCrops.Contains(obj.ParentSheetIndex)) { int needed = metadata.Constants.PolycultureCount - GameHelper.GetShipped(obj.ParentSheetIndex); if (needed > 0) { neededFor.Add(this.Translate(L10n.Item.NeededForPolyculture, new { count = needed })); } } // full shipment achievement if (isObject && GameHelper.GetFullShipmentAchievementItems().Any(p => p.Key == obj.ParentSheetIndex && !p.Value)) { neededFor.Add(this.Translate(L10n.Item.NeededForFullShipment)); } // a full collection achievement LibraryMuseum museum = Game1.locations.OfType <LibraryMuseum>().FirstOrDefault(); if (museum != null && museum.isItemSuitableForDonation(obj)) { neededFor.Add(this.Translate(L10n.Item.NeededForFullCollection)); } // yield if (neededFor.Any()) { yield return(new GenericField(this.Translate(L10n.Item.NeededFor), string.Join(", ", neededFor))); } } // sale data if (canSell && !isCrop) { // sale price string saleValueSummary = GenericField.GetSaleValueString(this.GetSaleValue(item, this.KnownQuality, metadata), item.Stack, this.Text); yield return(new GenericField(this.Translate(L10n.Item.SellsFor), saleValueSummary)); // sell to List <string> buyers = new List <string>(); if (obj?.canBeShipped() == true) { buyers.Add(this.Translate(L10n.Item.SellsToShippingBox)); } buyers.AddRange( from shop in metadata.Shops where shop.BuysCategories.Contains(item.category) let name = this.Translate(shop.DisplayKey).ToString() orderby name select name ); yield return(new GenericField(this.Translate(L10n.Item.SellsTo), string.Join(", ", buyers))); } // gift tastes var giftTastes = this.GetGiftTastes(item, metadata); yield return(new ItemGiftTastesField(this.Translate(L10n.Item.LovesThis), giftTastes, GiftTaste.Love)); yield return(new ItemGiftTastesField(this.Translate(L10n.Item.LikesThis), giftTastes, GiftTaste.Like)); } // fence if (item is Fence fence) { string healthLabel = this.Translate(L10n.Item.FenceHealth); // health if (Game1.getFarm().isBuildingConstructed(Constant.BuildingNames.GoldClock)) { yield return(new GenericField(healthLabel, this.Translate(L10n.Item.FenceHealthGoldClock))); } else { float maxHealth = fence.isGate ? fence.maxHealth * 2 : fence.maxHealth; float health = fence.health / maxHealth; double daysLeft = Math.Round(fence.health * metadata.Constants.FenceDecayRate / 60 / 24); double percent = Math.Round(health * 100); yield return(new PercentageBarField(healthLabel, (int)fence.health, (int)maxHealth, Color.Green, Color.Red, this.Translate(L10n.Item.FenceHealthSummary, new { percent = percent, count = daysLeft }))); } } // recipes if (item.GetSpriteType() == ItemSpriteType.Object) { RecipeModel[] recipes = GameHelper.GetRecipesForIngredient(this.DisplayItem).ToArray(); if (recipes.Any()) { yield return(new RecipesForIngredientField(this.Translate(L10n.Item.Recipes), item, recipes, this.Text)); } } // owned if (showInventoryFields && !isCrop && !(item is Tool)) { yield return(new GenericField(this.Translate(L10n.Item.Owned), this.Translate(L10n.Item.OwnedSummary, new { count = GameHelper.CountOwnedItems(item) }))); } // see also crop bool seeAlsoCrop = isSeed && item.parentSheetIndex != this.SeedForCrop.indexOfHarvest && // skip seeds which produce themselves (e.g. coffee beans) !(item.parentSheetIndex >= 495 && item.parentSheetIndex <= 497) && // skip random seasonal seeds item.parentSheetIndex != 770; // skip mixed seeds if (seeAlsoCrop) { Item drop = GameHelper.GetObjectBySpriteIndex(this.SeedForCrop.indexOfHarvest); yield return(new LinkField(this.Translate(L10n.Item.SeeAlso), drop.DisplayName, () => new ItemSubject(this.Text, drop, ObjectContext.Inventory, false, this.SeedForCrop))); } }
// オブジェクトのデータ登録 public void SetOdata(ObjectData odata) { Odata = odata; }
private LoopControlStatement(ObjectData data) { Label = data.GetString("ControlType"); ControlType = (LoopControlType)data.GetInt32("ControlType"); WhenExpression = data.GetValue <SqlExpression>("WhenExpression"); }
public override void Init(ObjectData data, string name, Device dev) { model = ObjectHelper.LoadModel("Objects/Collision/C CYLINDER.sa1mdl"); meshes = ObjectHelper.GetMeshes(model, dev); }
public SaveData(int HP, Main main, Shop shop, Weapon _weapon) { //Player health = Player.S.GetHP(); maxHP = Player.S.GetMaxHP(); hpLevel = Player.S.GetHpLevel(); maxHpLevel = Player.S.GetMaxHpLevel(); hpBonusPerLevel = Player.S.GetHpBonusPerLevel(); cost = Player.S.GetCost(); //Global gold = Main.S.gold; currentLevel = Main.S.currentLevel; currentWave = Main.S.waveCounter; //______WEAPONS________ riffleAmmo = _weapon.GetRifleAmmo(); //Pistolet PisCurrentAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetCurrentAmmo(); PisAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetAmmo(); PisCapacity = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetCapacity(); PisLevel = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetLevel(); PisFireRate = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetFireRate(); PisMoneyForUpgrade = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetMoneyForUpgrade(); PisBuyingPrice = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetBuyingPrice(); PisReloadSpeed = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetReloadSpeed(); PisDamage = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.ePistol).GetDamage(); //Półautomat if (_weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic) != null) { SemiCurrentAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetCurrentAmmo(); SemiAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetAmmo(); SemiCapacity = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetCapacity(); SemiLevel = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetLevel(); SemiFireRate = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetFireRate(); SemiMoneyForUpgrade = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetMoneyForUpgrade(); SemiBuyingPrice = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetBuyingPrice(); SemiReloadSpeed = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetReloadSpeed(); SemiDamage = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSemiAutomatic).GetDamage(); isSemiExist = true; } //Automat if (_weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic) != null) { AutoCurrentAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetCurrentAmmo(); AutoAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetAmmo(); AutoCapacity = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetCapacity(); AutoLevel = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetLevel(); AutoFireRate = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetFireRate(); AutoMoneyForUpgrade = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetMoneyForUpgrade(); AutoBuyingPrice = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetBuyingPrice(); AutoReloadSpeed = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetReloadSpeed(); AutoDamage = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eAutomatic).GetDamage(); isAutoExist = true; } //Rifle if (_weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle) != null) { RifleCurrentAmmo = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetCurrentAmmo(); RifleAmmo = _weapon.GetSniperAmmo(); RifleCapacity = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetCapacity(); RifleLevel = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetLevel(); RifleFireRate = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetFireRate(); RifleMoneyForUpgrade = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetMoneyForUpgrade(); RifleBuyingPrice = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetBuyingPrice(); RifleReloadSpeed = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetReloadSpeed(); RifleDamage = _weapon.weapons.Find(gun => gun.GetType() == Weapon.WeaponType.eSniperRifle).GetDamage(); isRifleExist = true; } //______DEFENSIVE________ //Płot FencyCurrentLevel = shop.DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>().currentLevel; FencyHealth = shop.DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>().health; FencyUpgradePrice = shop.DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>().upgradePrice; //Kolce SpikeCurrentLevel = shop.DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>().currentLevel; SpikeHealth = shop.DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>().health; SpikeDamageEnemy = shop.DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>().damageEnemy; SpikeUpgradePrice = shop.DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>().upgradePrice; SpikeTakeDamage = shop.DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>().takeDamage; GameObject objects = Camera.main.GetComponent <Shop>().objectAnchor.gameObject; int number = objects.transform.childCount; objectOnMap = new List <ObjectData>(); for (int i = 0; i < number; ++i) { ObjectData objectData = new ObjectData(); Transform go = objects.transform.GetChild(i); objectData.x = go.position.x; objectData.y = go.position.y; objectData.z = go.position.z; if (go.tag == "DefensiveObject") { objectData.Health = go.GetComponent <DefensiveObject>().health; objectData.tag = "DefensiveObject"; } if (go.tag == "DefensiveSpikes") { objectData.Health = go.GetComponent <DefensiveSpikes>().health; objectData.tag = "DefensiveSpikes"; } objectOnMap.Add(objectData); } }
public override void Init(ObjectData data) { byte[] artfile = ObjectHelper.OpenArtFile("../artnem/Monitors.bin", CompressionType.Nemesis); img = ObjectHelper.MapASMToBmp(artfile, "../_maps/Invisible Barriers.asm", 0, 0); }
public override void Init(ObjectData data) { BuildSpritesSubtypes(7, true); }
public override void Init(ObjectData data, string name) { model = ObjectHelper.LoadModel("stg01_beach/common/models/sea02_taki.nja.sa1mdl"); mesh = ObjectHelper.GetMeshes(model); }
public void InitializeEHInfo(ObjectData ehInfo) { Debug.Assert(_ehInfo == null); _ehInfo = ehInfo; }