public Rod(Materials type, Color color) : this(type.ToString() + "Rod", null, color) { string name = type.ToStr(); DefaultDisplayName = name + Utils.Get("°ô"); DefaultDescription = "Rods are made by forging " + char.ToLower(name[0], CultureInfo.CurrentCulture) + name.Substring(1) + " into shape. They are useful for making many things."; }
public RottenEgg() : base(Utils.Get("腐蛋,不能吃。")) { DefaultDisplayName = "Rotten Egg"; var meshes = ContentManager.Get <Model>("Models/RottenEgg").Meshes; m_standaloneBlockMesh.AppendModelMeshPart(meshes[0].MeshParts[0], BlockMesh.GetBoneAbsoluteTransform(meshes[0].ParentBone), false, false, false, false, Color.White); }
public MetalLine(Materials type) { Id = type.ToString() + "Line"; DefaultTextureSlot = 212; DefaultDescription = (DefaultDisplayName = type.ToStr() + Utils.Get("Ë¿")) + "is made of " + type.ToStr() + " Ingot, it can be used in many place in the industrial era."; Color = MetalBlock.GetColor(type); }
public Wire(string craftingId) { Id = craftingId; DefaultTextureSlot = 213; DefaultDisplayName = Utils.Get("电线"); DefaultDescription = "电线是电气设备中的重要组成部分,尤其是发电机。"; }
public Plate(Materials type) : this(type.ToString() + "Plate", MetalBlock.GetColor(type)) { string name = type.ToStr(); DefaultDisplayName = name + Utils.Get("°å"); DefaultDescription = "A plate of pure " + name + ". Can be crafted into very durable and strong " + name + " items. Very important in the industrial era."; }
public OreChunk(Matrix transform, Matrix tcTransform, Color color, bool smooth, Materials type) { string name = type.ToStr(); Id = type.ToString() + "OreChunk"; DefaultDisplayName = name + Utils.Get("矿石块"); var sb = new StringBuilder(Utils.Get("一块")); if (type == Materials.Mercury) { sb.Append(Utils.Get("氧化")); } name = char.ToLower(name[0], CultureInfo.CurrentCulture) + name.Substring(1); sb.Append(name).Append(" ore. When smelted in the furnace will turn into pure "); if (type == Materials.Mercury) { sb.Append(Utils.Get("液态")); } sb.Append(name).Append('.'); DefaultDescription = sb.ToString(); Color = color; var model = ContentManager.Get <Model>(smooth ? "Models/ChunkSmooth" : "Models/Chunk"); m_standaloneBlockMesh.AppendModelMeshPart(model.Meshes[0].MeshParts[0], BlockMesh.GetBoneAbsoluteTransform(model.Meshes[0].ParentBone) * transform, false, false, false, false, color); m_standaloneBlockMesh.TransformTextureCoordinates(tcTransform); }
protected FixedDevice(string name, string description = "", int resistance = 1000) { //if (resistance < 1) throw new ArgumentOutOfRangeException("resistance", resistance, "Device has Resistance < 1"); DefaultDisplayName = Utils.Get(name); DefaultDescription = Utils.Get(description); Resistance = resistance; }
public Sheet(Materials type) : base(type) { string name = type.ToStr(); Id = type.ToString() + "Sheet"; DefaultDisplayName = name + Utils.Get("Ƭ"); DefaultDescription = "A sheet of pure " + name + ". Can be crafted into very durable and strong " + name + " items."; }
public Powder(string name, Color color, string description = null) { Id = name; DefaultDisplayName = Utils.Get(name); Color = color; DefaultTextureSlot = 198; DefaultDescription = description ?? name + " is powder obtained by crushing " + name + "."; }
public Fan(Materials type) { DefaultTextureSlot = 210; var name = type.ToStr(); Id = type.ToString() + "Fan"; DefaultDisplayName = name + Utils.Get("扇"); DefaultDescription = name + " Fan is a kind of fan made by " + name + "."; }
public MetalIngot(Materials type) { Id = type.ToString() + "Ingot"; string name = type.ToStr(); DefaultDisplayName = name + Utils.Get("¶§"); DefaultDescription = "An ingot of pure " + name + ". Can be crafted into very durable and strong " + name + " items. Very important in the industrial era."; m_standaloneBlockMesh.AppendMesh("Models/Ingots", "IronIngot", Matrix.CreateTranslation(0f, -0.1f, 0f), Matrix.Identity, MetalBlock.GetColor(type)); }
public Resistor(Materials type) { DefaultTextureSlot = 163; var name = type.ToStr(); Id = type.ToString() + "Resistor"; DefaultDisplayName = name + Utils.Get("电阻"); DefaultDescription = name + " Resistor is a kind of resistor obtained by " + name + "."; Color = new Color(55, 55, 55); }
public override string GetDescription(int value) { switch (GetType(value)) { default: //case DrillType.SteelDrill: //case DrillType.DiamondDrill: return(DefaultDescription); case DrillType.IronTubularis: case DrillType.SteelTubularis: return(Utils.Get("输液管是液体泵中最重要的部分,您应该在使用它时将其放入机器中。 提醒,泵送岩浆会损坏输液管。")); } }
public override string GetDescription(int value) { switch (GetType(value)) { case 0: return(Utils.Get("一些机器的基础外壳。 非常重且耐用。对 挖掘和爆炸都非常有抗性。 可以用多个铁板或钢锭制成。")); case 1: return(Utils.Get("某些机器或设备的高级外壳。 非常重且耐用。 对挖掘和爆炸都有非常有抗性。 可以用多个钢板制作。")); case 2: return(Utils.Get("防火砖墙可以通过将几块防火砖组合在一起并用砂浆粘合而制成。 它是一种多功能,坚固且美观的工业材料。")); default: var type = (Materials)(GetType(value) - 3); return(Utils.Get(type == Materials.Steel ? "钢块。 非常重且耐用。 对挖掘和爆炸都有非常好的抗性。 可以用多个钢锭制作。" : Utils.Get("一块纯") + type.ToStr() + Utils.Get("能由多块") + type.ToStr() + Utils.Get("锭制得。"))); } }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { int data = Terrain.ExtractData(value); string name = (data & 65536) != 0 ? Utils.Get("不稳定") : string.Empty; if ((data & 32768) != 0) { name += Utils.Get("易爆"); } data &= 16383; if (IsColored(data) || data == 0 || data > 20) { return(name + (data == 0 ? base.GetDisplayName(subsystemTerrain, value) : data == 22 ? "铀矿石" : "磷矿石")); } data = (data >> 1) + 14; name += ItemBlock.Items[data].GetDisplayName(subsystemTerrain, Terrain.ReplaceData(ItemBlock.Index, data)); return(name.Substring(0, name.Length - (Utils.TR.Count == 0 ? 2 : 5))); }
public override string GetCraftingId() { var sb = new StringBuilder(); string s; switch (MineType & MineType.Large) { case MineType.Tiny: s = "微型"; break; case MineType.Small: s = "小型"; break; case MineType.Medium: s = "中型"; break; default: s = "大型"; break; } sb.Append(Utils.Get(s)); if ((MineType & MineType.Incendiary) != 0) { sb.Append(Utils.Get("易燃")); } if ((MineType & MineType.Sensitive) != 0) { sb.Append(Utils.Get("敏感")); } if ((MineType & MineType.FL) != 0) { sb.Append(Utils.Get("松发")); } if (Delay > 0.0) { sb.Append(Delay.ToString()); sb.Append(Utils.Get("秒延迟")); } sb.Append(Utils.Get((MineType & MineType.Torpedo) == 0 ? "地雷" : "水雷")); return(sb.ToString()); }
public Powder(Materials type) : this(type.ToStr() + Utils.Get("矿粉"), Colors[(int)type]) { Id = type.ToString() + "OrePowder"; }
public CokeCoal() : base(Matrix.CreateRotationX(1f) * Matrix.CreateRotationZ(2f), Matrix.CreateTranslation(0.0625f, 0.4375f, 0f), new Color(175, 175, 175), false, Materials.Steel) { Id = "CokeCoalChunk"; DefaultDisplayName = Utils.Get("焦炭"); DefaultDescription = "焦炭看起来像炼焦煤获得的银块。 它可以用作工业领域中的燃料或还原剂。"; }
public static Widget OpenEntity(IInventory inventory, Entity entity) { var componentTrain = entity.FindComponent <ComponentTrain>(); var componentChest = entity.FindComponent <ComponentChest>(); if (componentTrain != null) { return(componentChest != null ? new NewChestWidget(inventory, componentChest, Utils.Get(componentTrain.ParentBody != null ? "车厢(已连接)" : "车厢")) : (Widget) new StoveWidget(inventory, componentTrain.ComponentEngine, "Widgets/TrainWidget")); } var componentEngine = entity.FindComponent <ComponentEngine>(); if (componentEngine != null) { return(new Engine2Widget(inventory, componentEngine)); } var componentEngine3 = entity.FindComponent <ComponentEngineA>(); if (componentEngine3 != null) { return(new EngineAWidget(inventory, componentEngine3)); } return(null); }
public new void HandleInput() { WidgetInput input = m_componentPlayer.View.Input; PlayerInput playerInput = m_componentPlayer.ComponentInput.PlayerInput; ComponentRider componentRider = m_componentPlayer.ComponentRider; if (m_componentPlayer.View.ActiveCamera.IsEntityControlEnabled) { if (!m_keyboardHelpMessageShown && (m_componentPlayer.PlayerData.InputDevice & WidgetInputDevice.Keyboard) != 0 && Time.PeriodicEvent(7.0, 0.0)) { m_keyboardHelpMessageShown = true; DisplaySmallMessage(Utils.Get("按 H 键查看键盘控制帮助\n(或看帮助)"), true, true); } else if (!m_gamepadHelpMessageShown && (m_componentPlayer.PlayerData.InputDevice & WidgetInputDevice.Gamepads) != 0 && Time.PeriodicEvent(7.0, 0.0)) { m_gamepadHelpMessageShown = true; DisplaySmallMessage(Utils.Get("按 START/PAUSE 键查看手柄控制帮助\n(或看帮助)"), true, true); } } if (playerInput.KeyboardHelp) { if (m_keyboardHelpDialog == null) { m_keyboardHelpDialog = new KeyboardHelpDialog(); } if (m_keyboardHelpDialog.ParentWidget != null) { DialogsManager.HideDialog(m_keyboardHelpDialog); } else { DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, m_keyboardHelpDialog); } } if (playerInput.GamepadHelp) { if (m_gamepadHelpDialog == null) { m_gamepadHelpDialog = new GamepadHelpDialog(); } if (m_gamepadHelpDialog.ParentWidget != null) { DialogsManager.HideDialog(m_gamepadHelpDialog); } else { DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, m_gamepadHelpDialog); } } if (m_helpButtonWidget.IsClicked) { ScreensManager.SwitchScreen("Help"); } IInventory inventory = m_componentPlayer.ComponentMiner.Inventory; if (playerInput.ToggleInventory || m_inventoryButtonWidget.IsClicked) { if (componentRider.Mount != null && ModalPanelWidget == null) { Widget widget = OpenEntity(inventory, m_componentPlayer.ComponentRider.Mount.Entity); if (widget != null) { ModalPanelWidget = widget; AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f); return; } } ModalPanelWidget = IsInventoryVisible() ? null : inventory is ComponentCreativeInventory ? new CreativeInventoryWidget(m_componentPlayer.Entity) : (Widget) new FullInventoryWidget(inventory, m_componentPlayer.Entity.FindComponent <ComponentCraftingTable>(true)); } if (playerInput.ToggleClothing || m_clothingButtonWidget.IsClicked) { ModalPanelWidget = IsClothingVisible() ? null : new ClothingWidget(m_componentPlayer); } if (m_sneakButtonWidget.IsClicked || playerInput.ToggleSneak) { bool isSneaking = m_componentPlayer.ComponentBody.IsSneaking; m_componentPlayer.ComponentBody.IsSneaking = !isSneaking; if (m_componentPlayer.ComponentBody.IsSneaking != isSneaking) { DisplaySmallMessage(Utils.Get(m_componentPlayer.ComponentBody.IsSneaking ? "潜行模式:开" : "潜行模式:关"), false, false); } } if (componentRider != null && (m_mountButtonWidget.IsClicked || playerInput.ToggleMount)) { bool flag = componentRider.Mount != null; if (flag) { componentRider.StartDismounting(); } else { ComponentMount componentMount = FindNearestMount(componentRider); if (componentMount != null) { componentRider.StartMounting(componentMount); } } if (componentRider.Mount != null != flag) { DisplaySmallMessage(Utils.Get(componentRider.Mount != null ? "上马" : "下马"), false, false); } } if ((m_editItemButton.IsClicked || playerInput.EditItem) && m_nearbyEditableCell.HasValue) { int cellValue = m_subsystemTerrain.Terrain.GetCellValue(m_nearbyEditableCell.Value.X, m_nearbyEditableCell.Value.Y, m_nearbyEditableCell.Value.Z); int contents = Terrain.ExtractContents(cellValue); SubsystemBlockBehavior[] blockBehaviors = m_subsystemBlockBehaviors.GetBlockBehaviors(contents); for (int i = 0; i < blockBehaviors.Length && !blockBehaviors[i].OnEditBlock(m_nearbyEditableCell.Value.X, m_nearbyEditableCell.Value.Y, m_nearbyEditableCell.Value.Z, cellValue, m_componentPlayer); i++) { } } else if ((m_editItemButton.IsClicked || playerInput.EditItem) && IsActiveSlotEditable()) { if (inventory != null) { int activeSlotIndex = inventory.ActiveSlotIndex; int num = Terrain.ExtractContents(inventory.GetSlotValue(activeSlotIndex)); if (BlocksManager.Blocks[num].IsEditable) { SubsystemBlockBehavior[] blockBehaviors2 = m_subsystemBlockBehaviors.GetBlockBehaviors(num); for (int j = 0; j < blockBehaviors2.Length && !blockBehaviors2[j].OnEditInventoryItem(inventory, activeSlotIndex, m_componentPlayer); j++) { } } } } bool isCreative = m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative; if (isCreative && (m_creativeFlyButtonWidget.IsClicked || playerInput.ToggleCreativeFly) && componentRider.Mount == null) { bool isCreativeFlyEnabled = m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled; m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled = !isCreativeFlyEnabled; if (m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled != isCreativeFlyEnabled) { if (m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled) { m_componentPlayer.ComponentLocomotion.JumpOrder = 1f; DisplaySmallMessage(Utils.Get("飞行模式:开"), false, false); } else { DisplaySmallMessage(Utils.Get("飞行模式:关"), false, false); } } } if (m_cameraButtonWidget.IsClicked || playerInput.SwitchCameraMode) { View view = m_componentPlayer.View; if (view.ActiveCamera.GetType() == typeof(FppCamera)) { view.ActiveCamera = view.FindCamera <TppCamera>(true); DisplaySmallMessage(Utils.Get("第三人称视角"), false, false); } else if (view.ActiveCamera.GetType() == typeof(TppCamera)) { view.ActiveCamera = view.FindCamera <OrbitCamera>(true); DisplaySmallMessage(Utils.Get("滑轨视角"), false, false); } else if (view.ActiveCamera.GetType() == typeof(OrbitCamera)) { view.ActiveCamera = isCreative ? (Camera) new DebugCamera(view) : view.FindCamera <FixedCamera>(true); DisplaySmallMessage(Utils.Get(isCreative ? "调试视角" : "固定视角"), false, false); } else if (isCreative && view.ActiveCamera.GetType() == typeof(FixedCamera)) { view.ActiveCamera = new FlyCamera(view); DisplaySmallMessage(Utils.Get("飞行视角"), false, false); } else if (view.ActiveCamera.GetType() == typeof(DebugCamera)) { view.ActiveCamera = view.FindCamera <FixedCamera>(true); DisplaySmallMessage(Utils.Get("固定视角"), false, false); } else if (view.ActiveCamera.GetType() == typeof(FlyCamera)) { view.ActiveCamera = new RandomJumpCamera(view); DisplaySmallMessage(Utils.Get("随机跳跃视角"), false, false); } else if (view.ActiveCamera.GetType() == typeof(RandomJumpCamera)) { view.ActiveCamera = new StraightFlightCamera(view); DisplaySmallMessage(Utils.Get("垂直飞行视角"), false, false); } else { view.ActiveCamera = view.FindCamera <FppCamera>(true); DisplaySmallMessage(Utils.Get("第一人称视角"), false, false); } } if (m_photoButtonWidget.IsClicked || playerInput.TakeScreenshot) { ScreenCaptureManager.CapturePhoto(); Time.QueueFrameCountDelayedExecution(Time.FrameIndex + 1, delegate { DisplaySmallMessage(Utils.Get("照片已保存到图片相册"), false, false); }); } if (isCreative && (m_lightningButtonWidget.IsClicked || playerInput.Lighting)) { Project.FindSubsystem <SubsystemWeather>(true).ManualLightingStrike(m_componentPlayer.ComponentCreatureModel.EyePosition, Matrix.CreateFromQuaternion(m_componentPlayer.ComponentCreatureModel.EyeRotation).Forward); } if (isCreative && (m_timeOfDayButtonWidget.IsClicked || playerInput.TimeOfDay)) { float num2 = MathUtils.Remainder(0.25f, 1f); float num3 = MathUtils.Remainder(0.5f, 1f); float num4 = MathUtils.Remainder(0.75f, 1f); float num5 = MathUtils.Remainder(1f, 1f); float num6 = MathUtils.Remainder(num2 - m_subsystemTimeOfDay.TimeOfDay, 1f); float num7 = MathUtils.Remainder(num3 - m_subsystemTimeOfDay.TimeOfDay, 1f); float num8 = MathUtils.Remainder(num4 - m_subsystemTimeOfDay.TimeOfDay, 1f); float num9 = MathUtils.Remainder(num5 - m_subsystemTimeOfDay.TimeOfDay, 1f); float num10 = MathUtils.Min(num6, num7, num8, num9); if (num6 == num10) { m_subsystemTimeOfDay.TimeOfDayOffset += num6; DisplaySmallMessage(Utils.Get("黎明"), false, false); } else if (num7 == num10) { m_subsystemTimeOfDay.TimeOfDayOffset += num7; DisplaySmallMessage(Utils.Get("中午"), false, false); } else if (num8 == num10) { m_subsystemTimeOfDay.TimeOfDayOffset += num8; DisplaySmallMessage(Utils.Get("黄昏"), false, false); } else if (num9 == num10) { m_subsystemTimeOfDay.TimeOfDayOffset += num9; DisplaySmallMessage(Utils.Get("午夜"), false, false); } } if (ModalPanelWidget != null) { if (input.Cancel || input.Back || m_backButtonWidget.IsClicked) { ModalPanelWidget = null; } } else if (input.Back || m_backButtonWidget.IsClicked) { DialogsManager.ShowDialog(m_componentPlayer.View.GameWidget, new GameMenuDialog(m_componentPlayer)); } return; }
public new void Update(float dt) { PlayerInput playerInput = ComponentInput.PlayerInput; if (ComponentInput.IsControlledByTouch && m_aimDirection.HasValue) { playerInput.Look = Vector2.Zero; } if (ComponentMiner.Inventory != null) { ComponentMiner.Inventory.ActiveSlotIndex = MathUtils.Clamp(ComponentMiner.Inventory.ActiveSlotIndex + playerInput.ScrollInventory, 0, 5); if (playerInput.SelectInventorySlot.HasValue) { ComponentMiner.Inventory.ActiveSlotIndex = MathUtils.Clamp(playerInput.SelectInventorySlot.Value, 0, 5); } } if (m_subsystemTime.PeriodicGameTimeEvent(0.5, 0)) { ReadOnlyList <int> readOnlyList = ComponentClothing.GetClothes(ClothingSlot.Head); if ((readOnlyList.Count > 0 && ClothingBlock.GetClothingData(readOnlyList[readOnlyList.Count - 1]).DisplayName == Utils.Get("DZˮͷ¿ø")) || (ComponentBody.ImmersionFluidBlock != null && ComponentBody.ImmersionFluidBlock.BlockIndex == RottenMeatBlock.Index)) { //if (ComponentBody.ImmersionDepth > 0.8f) //ComponentScreenOverlays.BlackoutFactor = 1f; ComponentHealth.Air = 1f; } } ComponentMount mount = ComponentRider.Mount; if (mount != null) { var componentSteedBehavior = mount.Entity.FindComponent <ComponentSteedBehavior>(); if (componentSteedBehavior != null) { if (playerInput.Move.Z > 0.5f && !m_speedOrderBlocked) { if (PlayerData.PlayerClass == PlayerClass.Male) { m_subsystemAudio.PlayRandomSound("Audio/Creatures/MaleYellFast", 0.75f, 0f, ComponentBody.Position, 2f, false); } else { m_subsystemAudio.PlayRandomSound("Audio/Creatures/FemaleYellFast", 0.75f, 0f, ComponentBody.Position, 2f, false); } componentSteedBehavior.SpeedOrder = 1; m_speedOrderBlocked = true; } else if (playerInput.Move.Z < -0.5f && !m_speedOrderBlocked) { if (PlayerData.PlayerClass == PlayerClass.Male) { m_subsystemAudio.PlayRandomSound("Audio/Creatures/MaleYellSlow", 0.75f, 0f, ComponentBody.Position, 2f, false); } else { m_subsystemAudio.PlayRandomSound("Audio/Creatures/FemaleYellSlow", 0.75f, 0f, ComponentBody.Position, 2f, false); } componentSteedBehavior.SpeedOrder = -1; m_speedOrderBlocked = true; } else if (MathUtils.Abs(playerInput.Move.Z) <= 0.25f) { m_speedOrderBlocked = false; } componentSteedBehavior.TurnOrder = playerInput.Move.X; componentSteedBehavior.JumpOrder = playerInput.Jump ? 1 : 0; ComponentLocomotion.LookOrder = new Vector2(playerInput.Look.X, 0f); } else { var componentBoat = mount.Entity.FindComponent <ComponentBoat>(); if (componentBoat != null || mount.Entity.FindComponent <ComponentBoatI>() != null) { if (componentBoat != null) { componentBoat.TurnOrder = playerInput.Move.X; componentBoat.MoveOrder = playerInput.Move.Z; ComponentLocomotion.LookOrder = new Vector2(playerInput.Look.X, 0f); } else { ComponentLocomotion.LookOrder = playerInput.Look; } ComponentCreatureModel.RowLeftOrder = playerInput.Move.X <-0.2f || playerInput.Move.Z> 0.2f; ComponentCreatureModel.RowRightOrder = playerInput.Move.X > 0.2f || playerInput.Move.Z > 0.2f; } var c = mount.Entity.FindComponent <ComponentLocomotion>(); if (c != null) { c.WalkOrder = playerInput.Move.XZ; c.FlyOrder = new Vector3(0f, playerInput.Move.Y, 0f); c.TurnOrder = playerInput.Look * new Vector2(1f, 0f); c.JumpOrder = playerInput.Jump ? 1 : 0; c.LookOrder = playerInput.Look; if (playerInput.ToggleCreativeFly) { c.IsCreativeFlyEnabled = !c.IsCreativeFlyEnabled; } } } } else { ComponentLocomotion.WalkOrder = (ComponentLocomotion.WalkOrder ?? Vector2.Zero) + (ComponentBody.IsSneaking ? (0.66f * new Vector2(playerInput.SneakMove.X, playerInput.SneakMove.Z)) : new Vector2(playerInput.Move.X, playerInput.Move.Z)); ComponentLocomotion.FlyOrder = new Vector3(0f, playerInput.Move.Y, 0f); ComponentLocomotion.TurnOrder = playerInput.Look * new Vector2(1f, 0f); ComponentLocomotion.JumpOrder = MathUtils.Max(playerInput.Jump ? 1 : 0, ComponentLocomotion.JumpOrder); } ComponentLocomotion.LookOrder += playerInput.Look * (SettingsManager.FlipVerticalAxis ? new Vector2(0f, -1f) : new Vector2(0f, 1f)); int num = Terrain.ExtractContents(ComponentMiner.ActiveBlockValue); Block block = BlocksManager.Blocks[num]; bool flag = false; if (playerInput.Interact.HasValue && !flag && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185) { Vector3 viewPosition = View.ActiveCamera.ViewPosition; var direction = Vector3.Normalize(View.ActiveCamera.ScreenToWorld(new Vector3(playerInput.Interact.Value, 1f), Matrix.Identity) - viewPosition); if (!ComponentMiner.Use(viewPosition, direction)) { var body = ComponentMiner.PickBody(viewPosition, direction); var result = ComponentMiner.PickTerrainForInteraction(viewPosition, direction); if (result.HasValue && (!body.HasValue || result.Value.Distance < body.Value.Distance)) { if (!ComponentMiner.Interact(result.Value)) { if (ComponentMiner.Place(result.Value)) { m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate(); flag = true; m_isAimBlocked = true; } } else { m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate(); flag = true; m_isAimBlocked = true; } } } else { m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate(); flag = true; m_isAimBlocked = true; } } float num2 = (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative || block.BlockIndex == Musket2Block.Index) ? 0.1f : 1.4f; Vector3 viewPosition2 = View.ActiveCamera.ViewPosition; if (playerInput.Aim.HasValue && block.IsAimable && m_subsystemTime.GameTime - m_lastActionTime > num2) { if (!m_isAimBlocked) { Vector2 value = playerInput.Aim.Value; Vector3 v = View.ActiveCamera.ScreenToWorld(new Vector3(value, 1f), Matrix.Identity); Point2 size = Window.Size; if (playerInput.Aim.Value.X >= size.X * 0.1f && playerInput.Aim.Value.X < size.X * 0.9f && playerInput.Aim.Value.Y >= size.Y * 0.1f && playerInput.Aim.Value.Y < size.Y * 0.9f) { m_aimDirection = Vector3.Normalize(v - viewPosition2); if (ComponentMiner.Aim(viewPosition2, m_aimDirection.Value, AimState.InProgress)) { ComponentMiner.Aim(viewPosition2, m_aimDirection.Value, AimState.Cancelled); m_aimDirection = null; m_isAimBlocked = true; } } else if (m_aimDirection.HasValue) { ComponentMiner.Aim(viewPosition2, m_aimDirection.Value, AimState.Cancelled); m_aimDirection = null; m_isAimBlocked = true; } } } else { m_isAimBlocked = false; if (m_aimDirection.HasValue) { ComponentMiner.Aim(viewPosition2, m_aimDirection.Value, AimState.Completed); m_aimDirection = null; m_lastActionTime = m_subsystemTime.GameTime; } } flag |= m_aimDirection.HasValue; if (playerInput.Hit.HasValue && !flag && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185) { Vector3 viewPosition3 = View.ActiveCamera.ViewPosition; var vector = Vector3.Normalize(View.ActiveCamera.ScreenToWorld(new Vector3(playerInput.Hit.Value, 1f), Matrix.Identity) - viewPosition3); TerrainRaycastResult?nullable3 = ComponentMiner.PickTerrainForInteraction(viewPosition3, vector); BodyRaycastResult? nullable4 = ComponentMiner.PickBody(viewPosition3, vector); if (nullable4.HasValue && (!nullable3.HasValue || nullable3.Value.Distance > nullable4.Value.Distance)) { if (ComponentMiner.ActiveBlockValue == 0) { Widget widget = ComponentNGui.OpenEntity(ComponentMiner.Inventory, nullable4.Value.ComponentBody.Entity); if (widget != null) { ComponentGui.ModalPanelWidget = widget; AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f); return; } } flag = true; m_isDigBlocked = true; if (Vector3.Distance(viewPosition3 + vector * nullable4.Value.Distance, ComponentCreatureModel.EyePosition) <= 2f) { ComponentMiner.Hit(nullable4.Value.ComponentBody, vector); } } } if (playerInput.Dig.HasValue && !flag && !m_isDigBlocked && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185) { Vector3 viewPosition4 = View.ActiveCamera.ViewPosition; Vector3 v2 = View.ActiveCamera.ScreenToWorld(new Vector3(playerInput.Dig.Value, 1f), Matrix.Identity); TerrainRaycastResult?nullable5 = ComponentMiner.PickTerrainForDigging(viewPosition4, v2 - viewPosition4); if (nullable5.HasValue && ComponentMiner.Dig(nullable5.Value)) { m_lastActionTime = m_subsystemTime.GameTime; m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate(); } } if (!playerInput.Dig.HasValue) { m_isDigBlocked = false; } if (playerInput.Drop && ComponentMiner.Inventory != null) { IInventory inventory = ComponentMiner.Inventory; int slotValue = inventory.GetSlotValue(inventory.ActiveSlotIndex); int num3 = inventory.RemoveSlotItems(count: inventory.GetSlotCount(inventory.ActiveSlotIndex), slotIndex: inventory.ActiveSlotIndex); if (slotValue != 0 && num3 != 0) { Vector3 v3 = ComponentBody.Position + new Vector3(0f, ComponentBody.BoxSize.Y * 0.66f, 0f); Matrix matrix = ComponentBody.Matrix; Vector3 position = v3 + 0.25f * matrix.Forward; matrix = Matrix.CreateFromQuaternion(ComponentCreatureModel.EyeRotation); Vector3 value2 = 8f * matrix.Forward; m_subsystemPickables.AddPickable(slotValue, num3, position, value2, null); } } if (playerInput.PickBlockType.HasValue && !flag) { if (ComponentMiner.Inventory is ComponentCreativeInventory componentCreativeInventory) { Vector3 viewPosition5 = View.ActiveCamera.ViewPosition; Vector3 v4 = View.ActiveCamera.ScreenToWorld(new Vector3(playerInput.PickBlockType.Value, 1f), Matrix.Identity); TerrainRaycastResult?nullable6 = ComponentMiner.PickTerrainForDigging(viewPosition5, v4 - viewPosition5); if (nullable6.HasValue) { int value3 = nullable6.Value.Value; value3 = Terrain.ReplaceLight(value3, 0); int num4 = Terrain.ExtractContents(value3); Block block2 = BlocksManager.Blocks[num4]; int num5 = 0; var creativeValues = block2.GetCreativeValues(); if (block2.GetCreativeValues().Contains(value3)) { num5 = value3; } if (num5 == 0 && !block2.IsNonDuplicable) { var list = new List <BlockDropValue>(); bool _; block2.GetDropValues(m_subsystemTerrain, value3, 0, 2147483647, list, out _); if (list.Count > 0 && list[0].Count > 0) { num5 = list[0].Value; } } if (num5 == 0) { num5 = creativeValues.FirstOrDefault(); } if (num5 != 0) { int num6 = -1; for (int i = 0; i < 6; i++) { if (componentCreativeInventory.GetSlotCount(i) > 0 && componentCreativeInventory.GetSlotValue(i) == num5) { num6 = i; break; } } if (num6 < 0) { for (int j = 0; j < 6; j++) { if (componentCreativeInventory.GetSlotCount(j) == 0 || componentCreativeInventory.GetSlotValue(j) == 0) { num6 = j; break; } } } if (num6 < 0) { num6 = componentCreativeInventory.ActiveSlotIndex; } componentCreativeInventory.RemoveSlotItems(num6, 2147483647); componentCreativeInventory.AddSlotItems(num6, num5, 1); componentCreativeInventory.ActiveSlotIndex = num6; ComponentGui.DisplaySmallMessage(block2.GetDisplayName(m_subsystemTerrain, value3), false, false); m_subsystemAudio.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f, 0f); } } } } HighlightRaycastResult = ComponentMiner.PickTerrainForDigging(View.ActiveCamera.ViewPosition, View.ActiveCamera.ViewDirection); }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { return(Utils.Get("工业电线")); }
public override string GetDescription(int value) { return((Terrain.ExtractData(value) & 1024) != 0 ? Utils.Get("ȼÆøÂÖ»ú") : DefaultDescription); }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { return((Terrain.ExtractData(value) & 1024) != 0 ? Utils.Get("ȼÆøÂÖ»ú") : DefaultDisplayName); }
public override string GetDescription(int value) { return(Terrain.ExtractData(value) >> 10 != 0 ? Utils.Get("ÕôÆûÂÖ»ú") : DefaultDescription); }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { return(Terrain.ExtractData(value) >> 10 != 0 ? Utils.Get("ÕôÆûÂÖ»ú") : DefaultDisplayName); }
public override string GetCategory(int value) => Utils.Get("化学");
public RefractoryBrick() : base(Utils.Get("ÄÍ»ðשÊÇÒ»ÖÖÄÍ»ðÌմɲÄÁÏ£¬ÓÃÓÚ¯³Ä¯£¬Ò¤Â¯£¬¸ß¼¶È¼ÉÕÊҺͱÚ¯¡£ Ëü¾ßÓÐÄ͸ßÎÂÐÔÄÜ£¬µ«µ¼ÈÈϵÊýµÍ£¬ÄÜЧ¸ß¡£")) { m_standaloneBlockMesh.AppendMesh("Models/Brick", "Brick", Matrix.CreateTranslation(0f, -.02f, 0f) * 1.4f, Matrix.CreateTranslation(-32 % 16 / 16f, -32 / 16 / 16f, 0f), new Color(255, 153, 18)); }
public CoalPowder(string name, Color color, float heatLevel = 1700f, float fuelFireDuration = 60f, string description = "煤粉是通过破碎煤块而得到的黑色粉末。它可以用作燃料。") : base(name + Utils.Get("粉"), color) { Id = name + "Powder"; DefaultDescription = description; HeatLevel = heatLevel; FuelFireDuration = fuelFireDuration; }
public override string GetDescription(int value) { value = Terrain.ExtractData(value) >> 10; return(value != 0 ? Utils.Get(Names[value - 1]) : DefaultDescription); }