public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int color2 = GetColor(Terrain.ExtractData(value)); BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBucketBlockMesh, color, 2f * size, ref matrix, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_standalonePaintBlockMesh, color * SubsystemPalette.GetColor(environmentData, color2), 2f * size, ref matrix, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int type = GetType(value); color = (type < 3 ? Colors[type] : GetColor((Materials)(type - 3))) * SubsystemPalette.GetColor(environmentData, GetPaintColor(value)); BlocksManager.DrawCubeBlock(primitivesRenderer, value, new Vector3(size), ref matrix, color, color, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int? paintColor = GetPaintColor(value); Color color2 = paintColor.HasValue ? (color * SubsystemPalette.GetColor(environmentData, paintColor)) : (1.25f * WireColor * color); BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color2, 2f * size, ref matrix, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { float num = 8f; if (environmentData != null && environmentData.SubsystemTerrain != null) { Vector3 translation = environmentData.InWorldMatrix.Translation; int num2 = Terrain.ToCell(translation.X); int num3 = Terrain.ToCell(translation.Z); float f = translation.X - (float)num2; float f2 = translation.Z - (float)num3; float x = environmentData.SubsystemTerrain.Terrain.GetSeasonalTemperature(num2, num3); float x2 = environmentData.SubsystemTerrain.Terrain.GetSeasonalTemperature(num2, num3 + 1); float x3 = environmentData.SubsystemTerrain.Terrain.GetSeasonalTemperature(num2 + 1, num3); float x4 = environmentData.SubsystemTerrain.Terrain.GetSeasonalTemperature(num2 + 1, num3 + 1); float x5 = MathUtils.Lerp(x, x2, f2); float x6 = MathUtils.Lerp(x3, x4, f2); num = MathUtils.Lerp(x5, x6, f); } float y = MathUtils.Lerp(1f, 4f, num / 15f); Matrix matrix2 = Matrix.CreateScale(3f * size) * Matrix.CreateTranslation(0f, -0.15f, 0f) * matrix; Matrix matrix3 = Matrix.CreateTranslation(0f, 0f - m_fluidBottomPosition, 0f) * Matrix.CreateScale(1f, y, 1f) * Matrix.CreateTranslation(0f, m_fluidBottomPosition, 0f) * matrix2; BlocksManager.DrawMeshBlock(primitivesRenderer, m_caseMesh, color, 1f, ref matrix2, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_fluidMesh, color, 1f, ref matrix3, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { if (environmentData.SubsystemTerrain == null) { return; } int designIndex = GetDesignIndex(Terrain.ExtractData(value)); FurnitureDesign design = environmentData.SubsystemTerrain.SubsystemFurnitureBlockBehavior.GetDesign(designIndex); if (design == null) { return; } Vector3 v = default(Vector3); v.X = -0.5f * (float)(design.Box.Left + design.Box.Right) / (float)design.Resolution; v.Y = -0.5f * (float)(design.Box.Top + design.Box.Bottom) / (float)design.Resolution; v.Z = -0.5f * (float)(design.Box.Near + design.Box.Far) / (float)design.Resolution; Matrix matrix2 = Matrix.CreateTranslation(v * size) * matrix; FurnitureGeometry geometry = design.Geometry; for (int i = 0; i < 6; i++) { float s = LightingManager.LightIntensityByLightValueAndFace[environmentData.Light + 16 * CellFace.OppositeFace(i)]; Color color2 = Color.MultiplyColorOnly(color, s); if (geometry.SubsetOpaqueByFace[i] != null) { BlocksManager.DrawMeshBlock(primitivesRenderer, geometry.SubsetOpaqueByFace[i], color2, size, ref matrix2, environmentData); } if (geometry.SubsetAlphaTestByFace[i] != null) { BlocksManager.DrawMeshBlock(primitivesRenderer, geometry.SubsetAlphaTestByFace[i], color2, size, ref matrix2, environmentData); } } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int bulletType = (int)GetBulletType(Terrain.ExtractData(value)); float size2 = (bulletType >= 0 && bulletType < m_sizes.Length) ? (size * m_sizes[bulletType]) : size; BlocksManager.DrawFlatBlock(primitivesRenderer, value, size2, ref matrix, null, color, isEmissive: false, environmentData); }
public static int DecodeResult(string result) { var strArray = result.Split(':'); return(Terrain.MakeBlockValue(BlocksManager.FindBlockByTypeName(strArray[0], true).BlockIndex, 0, strArray.Length >= 2 ? int.Parse(strArray[1], CultureInfo.InvariantCulture) : 0)); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { float num = 8f; if (environmentData != null && environmentData.SubsystemTerrain != null) { Vector3 translation = environmentData.InWorldMatrix.Translation; int num2 = Terrain.ToCell(translation.X); int num3 = Terrain.ToCell(translation.Z); float f = translation.X - (float)num2; float f2 = translation.Z - (float)num3; float x = environmentData.SubsystemTerrain.Terrain.GetSeasonalHumidity(num2, num3); float x2 = environmentData.SubsystemTerrain.Terrain.GetSeasonalHumidity(num2, num3 + 1); float x3 = environmentData.SubsystemTerrain.Terrain.GetSeasonalHumidity(num2 + 1, num3); float x4 = environmentData.SubsystemTerrain.Terrain.GetSeasonalHumidity(num2 + 1, num3 + 1); float x5 = MathUtils.Lerp(x, x2, f2); float x6 = MathUtils.Lerp(x3, x4, f2); num = MathUtils.Lerp(x5, x6, f); } float radians = MathUtils.Lerp(1.5f, -1.5f, num / 15f); Matrix matrix2 = Matrix.CreateScale(7f * size) * Matrix.CreateTranslation(0f, -0.1f, 0f) * matrix; Matrix matrix3 = m_invPointerMatrix * Matrix.CreateRotationX(radians) * m_pointerMatrix * matrix2; BlocksManager.DrawMeshBlock(primitivesRenderer, m_caseMesh, color, 1f, ref matrix2, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_pointerMesh, color, 1f, ref matrix3, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); color *= SubsystemPalette.GetFabricColor(environmentData, GetColor(data)); BlocksManager.DrawCubeBlock(primitivesRenderer, value, new Vector3(size, 0.0625f * size, size), ref matrix, color, color, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); EggType eggType = GetEggType(data); BlocksManager.DrawMeshBlock(primitivesRenderer, eggType.BlockMesh, color, eggType.Scale * size, ref matrix, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { switch (Terrain.ExtractData(value)) { case 0: color *= new Color(160, 150, 125); break; case 1: color *= new Color(192, 160, 160); break; case 2: color *= new Color(192, 160, 192); break; case 3: color *= new Color(192, 192, 192); break; case 4: color *= new Color(60, 138, 76); break; case 6: color *= new Color(255, 255, 255); break; case 7: color *= new Color(240, 225, 190); break; } BlocksManager.DrawFlatBlock(primitivesRenderer, value, size, ref matrix, null, color, isEmissive: false, environmentData); }
public override void MeasureOverride(Vector2 parentAvailableSize) { m_blockIconWidget.IsVisible = false; m_labelWidget.IsVisible = false; if (!string.IsNullOrEmpty(m_ingredient)) { CraftingRecipesManager.DecodeIngredient(m_ingredient, out string craftingId, out int?data); Block[] array = BlocksManager.FindBlocksByCraftingId(craftingId); if (array.Length != 0) { Block block = array[(int)(1.0 * Time.RealTime) % array.Length]; if (block != null) { m_blockIconWidget.Value = Terrain.MakeBlockValue(block.BlockIndex, 0, data.HasValue ? data.Value : 4); m_blockIconWidget.Light = 15; m_blockIconWidget.IsVisible = true; } } } else if (m_resultValue != 0) { m_blockIconWidget.Value = m_resultValue; m_blockIconWidget.Light = 15; m_labelWidget.Text = m_resultCount.ToString(); m_blockIconWidget.IsVisible = true; m_labelWidget.IsVisible = true; } base.MeasureOverride(parentAvailableSize); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int? color2 = GetColor(Terrain.ExtractData(value)); Color c = color2.HasValue ? SubsystemPalette.GetColor(environmentData, color2) : m_copperColor; BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneSidesBlockMesh, color * c, 2f * size, ref matrix, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBulbBlockMesh, color, 2f * size, ref matrix, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int arrowType = (int)GetArrowType(Terrain.ExtractData(value)); if (arrowType >= 0 && arrowType < m_standaloneBlockMeshes.Count) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshes[arrowType], color, 2f * size, ref matrix, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int num = Terrain.ExtractData(value); if (num < m_blockMeshes.Length) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshes[num], color, size, ref matrix, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int mode = (int)GetMode(Terrain.ExtractData(value)); if (mode < m_standaloneBlockMeshes.Length && m_standaloneBlockMeshes[mode] != null) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshes[mode], color, 1f * size, ref matrix, environmentData); } }
public static int DecodeResult(string result) { if (ItemBlock.IdTable.TryGetValue(result, out int value)) { return(value); } var array = result.Split(':'); return(Terrain.MakeBlockValue(BlocksManager.FindBlockByTypeName(array[0], true).BlockIndex, 0, array.Length >= 2 ? int.Parse(array[1], CultureInfo.InvariantCulture) : 0)); }
public static int DecodeResult(string result) { if (!string.IsNullOrEmpty(result)) { string[] array = result.Split(new char[] { ':' }, StringSplitOptions.None); Block block = BlocksManager.FindBlockByTypeName(array[0], throwIfNotFound: true); return(Terrain.MakeBlockValue(data: (array.Length >= 2) ? int.Parse(array[1], CultureInfo.InvariantCulture) : 0, contents: block.BlockIndex, light: 0)); } return(0); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { if (GetHammerState(Terrain.ExtractData(value))) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshLoaded, color, 2f * size, ref matrix, environmentData); } else { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshUnloaded, color, 2f * size, ref matrix, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { if (GetIsWild(Terrain.ExtractData(value))) { color *= BlockColorsMap.GrassColorsMap.Lookup(environmentData.Temperature, environmentData.Humidity); BlocksManager.DrawFlatBlock(primitivesRenderer, value, size, ref matrix, null, color, isEmissive: false, environmentData); } else { BlocksManager.DrawFlatBlock(primitivesRenderer, value, size, ref matrix, null, color, isEmissive: false, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); int color2 = GetColor(data); Shape shape = GetShape(data); int altitude = GetAltitude(data); bool flickering = GetFlickering(data); BlocksManager.DrawMeshBlock(primitivesRenderer, m_headBlockMeshes[(int)shape * 8 + color2], color, 2f * size, ref matrix, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_bodyBlockMeshes[altitude], color, 2f * size, ref matrix, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_finsBlockMeshes[flickering ? 1 : 0], color, 2f * size, ref matrix, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int?color2 = GetColor(Terrain.ExtractData(value)); if (color2.HasValue) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneColoredBlockMesh, color * SubsystemPalette.GetColor(environmentData, color2), 1.25f * size, ref matrix, environmentData); } else { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color, 1.25f * size, ref matrix, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); int draw = GetDraw(data); ArrowBlock.ArrowType?arrowType = GetArrowType(data); BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMeshes[draw], color, 2f * size, ref matrix, environmentData); if (arrowType.HasValue) { Matrix matrix2 = Matrix.CreateRotationX(-(float)Math.PI / 2f) * Matrix.CreateTranslation(0f, 0.2f * size, -0.09f * size) * matrix; int value2 = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, arrowType.Value)); BlocksManager.Blocks[192].DrawBlock(primitivesRenderer, value2, color, size, ref matrix2, environmentData); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); int clothingColor = GetClothingColor(data); ClothingData clothingData = GetClothingData(data); Matrix matrix2 = m_slotTransforms[(int)clothingData.Slot] * Matrix.CreateScale(size) * matrix; if (clothingData.IsOuter) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_outerMesh, clothingData.Texture, color * SubsystemPalette.GetFabricColor(environmentData, clothingColor), 1f, ref matrix2, environmentData); } else { BlocksManager.DrawMeshBlock(primitivesRenderer, m_innerMesh, clothingData.Texture, color * SubsystemPalette.GetFabricColor(environmentData, clothingColor), 1f, ref matrix2, environmentData); } }
public float ApplyArmorProtection(float attackPower) { float num = m_random.Float(0f, 1f); ClothingSlot slot = (num < 0.1f) ? ClothingSlot.Feet : ((num < 0.3f) ? ClothingSlot.Legs : ((num < 0.9f) ? ClothingSlot.Torso : ClothingSlot.Head)); float num2 = ((ClothingBlock)BlocksManager.Blocks[203]).Durability + 1; List <int> list = new List <int>(GetClothes(slot)); for (int i = 0; i < list.Count; i++) { int value = list[i]; ClothingData clothingData = ClothingBlock.GetClothingData(Terrain.ExtractData(value)); float x = (num2 - (float)BlocksManager.Blocks[203].GetDamage(value)) / num2 * clothingData.Sturdiness; float num3 = MathUtils.Min(attackPower * MathUtils.Saturate(clothingData.ArmorProtection), x); if (num3 > 0f) { attackPower -= num3; if (m_subsystemGameInfo.WorldSettings.GameMode != 0) { float x2 = num3 / clothingData.Sturdiness * num2 + 0.001f; int damageCount = (int)(MathUtils.Floor(x2) + (float)(m_random.Bool(MathUtils.Remainder(x2, 1f)) ? 1 : 0)); list[i] = BlocksManager.DamageItem(value, damageCount); } if (!string.IsNullOrEmpty(clothingData.ImpactSoundsFolder)) { m_subsystemAudio.PlayRandomSound(clothingData.ImpactSoundsFolder, 1f, m_random.Float(-0.3f, 0.3f), m_componentBody.Position, 4f, 0.15f); } } } int num4 = 0; while (num4 < list.Count) { if (Terrain.ExtractContents(list[num4]) != 203) { list.RemoveAt(num4); m_subsystemParticles.AddParticleSystem(new BlockDebrisParticleSystem(m_subsystemTerrain, m_componentBody.Position + m_componentBody.BoxSize / 2f, 1f, 1f, Color.White, 0)); } else { num4++; } } SetClothes(slot, list); return(MathUtils.Max(attackPower, 0f)); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { float radians = 0f; if (environmentData != null && environmentData.SubsystemTerrain != null) { Vector3 forward = environmentData.InWorldMatrix.Forward; Vector3 translation = environmentData.InWorldMatrix.Translation; Vector3 v = environmentData.SubsystemTerrain.Project.FindSubsystem <SubsystemMagnetBlockBehavior>(throwOnError: true).FindNearestCompassTarget(translation); Vector3 vector = translation - v; radians = Vector2.Angle(v2: new Vector2(forward.X, forward.Z), v1: new Vector2(vector.X, vector.Z)); } Matrix matrix2 = matrix; Matrix matrix3 = Matrix.CreateRotationY(radians) * matrix; BlocksManager.DrawMeshBlock(primitivesRenderer, m_caseMesh, color, size * 6f, ref matrix2, environmentData); BlocksManager.DrawMeshBlock(primitivesRenderer, m_pointerMesh, color, size * 6f, ref matrix3, environmentData); }
public LoadingScreen() { WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/LoadingScreen")); LabelWidget ExternalAssemblyInfo = new LabelWidget(); ExternalAssemblyInfo.Text = "Powered By GScience Studio\n"; //下列两行代码请勿随意删除 ExternalAssemblyInfo.Text += "Author:" + Info.author + "\n"; ExternalAssemblyInfo.Text += "Version:" + Info.version; ExternalAssemblyInfo.Color = Color.LightBlue; ExternalAssemblyInfo.FontScale = 0.5f; this.ScreenWidget.Children.Add(ExternalAssemblyInfo); this.AddLoadAction((Action)(() => CommunityContentManager.Initialize())); this.AddLoadAction((Action)(() => MotdManager.Initialize())); this.AddLoadAction((Action)(() => LightingManager.Initialize())); this.AddLoadAction((Action)(() => StringsManager.LoadStrings())); this.AddLoadAction((Action)(() => TextureAtlasManager.LoadAtlases())); ReadOnlyList <ContentInfo> readOnlyList = ContentManager.List(); // ISSUE: explicit reference operation using (ReadOnlyList <ContentInfo> .Enumerator enumerator = ((ReadOnlyList <ContentInfo>)@readOnlyList).GetEnumerator()) { // ISSUE: explicit reference operation while (((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).MoveNext()) { // ISSUE: explicit reference operation ContentInfo localContentInfo = ((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).Current; this.AddLoadAction((Action)(() => ContentManager.Get((string)localContentInfo.Name))); } } this.AddLoadAction((Action)(() => DatabaseManager.LoadDatabase())); this.AddLoadAction((Action)(() => WorldsManager.Initialize())); this.AddLoadAction((Action)(() => BlocksTexturesManager.Initialize())); this.AddLoadAction((Action)(() => CharacterSkinsManager.Initialize())); this.AddLoadAction((Action)(() => FurniturePacksManager.Initialize())); this.AddLoadAction((Action)(() => BlocksManager.Initialize())); this.AddLoadAction((Action)(() => CraftingRecipesManager.Initialize())); this.AddLoadAction((Action)(() => GScienceStudio.InputManager.Initialize())); }
public List <List <int> > decodeIngredian(string[] ingredians) {//把配方解析成Block的value List <List <int> > result = new List <List <int> >(); foreach (string needname in ingredians) { List <int> values = new List <int>(); if (string.IsNullOrEmpty(needname)) { result.Add(values); continue; } if (needname.Contains(":")) { string[] split = needname.Split(':'); Block[] array = BlocksManager.FindBlocksByCraftingId(split[0]); if (array != null) { int dd = int.Parse(split[1], CultureInfo.InvariantCulture); int tt = Terrain.MakeBlockValue(array[0].BlockIndex, 0, dd); values.Add(getPosByValue(tt)); } } else { int k = 0; foreach (string element in craftids) { if (element == needname) { values.Add(k); } ++k; } } result.Add(values); } return(result); }
public void DamageActiveTool(int damageCount) { if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative || Inventory == null) { return; } int num = BlocksManager.DamageItem(ActiveBlockValue, damageCount); if (num != 0) { int slotCount = Inventory.GetSlotCount(Inventory.ActiveSlotIndex); Inventory.RemoveSlotItems(Inventory.ActiveSlotIndex, slotCount); if (Inventory.GetSlotCount(Inventory.ActiveSlotIndex) == 0) { Inventory.AddSlotItems(Inventory.ActiveSlotIndex, num, slotCount); } } else { Inventory.RemoveSlotItems(Inventory.ActiveSlotIndex, 1); } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color, size, ref matrix, environmentData); }