void SetSlot(GameObject slotObject, ShipComponentDatablock target, bool setBackgroundtexture = true) { var itemSlot = slotObject.GetComponent<UIItemSlot>(); if (target == null) { if (itemSlot == null) return; itemSlot.Assign(container.SlotEmptyTexture); return; } PlayMakerFSM.FindFsmOnGameObject(slotObject, "FSM").FsmVariables.FindFsmObject("ComponentObject").Value = target; var slotImages = slotObject.GetComponentsInChildren<Image>(); slotImages[1].sprite = Sprite.Create(target.Icon, new Rect(0, 0, target.Icon.width, target.Icon.height), new Vector2(0.5f, 0.5f)); slotImages[1].color = Color.white; if(setBackgroundtexture) slotImages[0].sprite = container.SlotFilledTexture; slotImages[0].color = Color.white; if (itemSlot == null) return; itemSlot.hoverNormalColor = Color.white; itemSlot.hoverHighlightColor = container.SlotFilledHoverColor; itemSlot.SetIcon(container.SlotFilledTexture); itemSlot.hoverTargetGraphic.color = Color.white; itemSlot.OnPointerExit(null); }
public ComponentSlot(ShipComponentDatablock script) { ChangeComponent(script); }
public CargoSlot(ShipComponentDatablock script) : base(script) { }
public ChassisSlot(ShipComponentDatablock script) : base(script) { }
public UtilitySlot(ShipComponentDatablock script) : base(script) { }
public WeaponSlot(ShipComponentDatablock script) : base(script) { }
public EngineSlot(ShipComponentDatablock script) : base(script) { }
public ShieldSlot(ShipComponentDatablock script) : base(script) { }
public DriveSlot(ShipComponentDatablock script) : base(script) { }
public void Load() { if (!System.String.IsNullOrEmpty(scriptName)) component = DatablockManager.Instance.GetDatablock<ShipComponentDatablock>(scriptName); }
public void ChangeComponent(ShipComponentDatablock script) { if (script != null) { component = script; scriptName = script.name; mods = new Dictionary<ShipStats, ComponentStat>(); } }
public override void OnExit() { component = null; base.OnExit(); }
public override void OnEnter() { base.OnEnter(); component = Fsm.EventData.ObjectData as ShipComponentDatablock; SetHeader(); SetInfo(); SetStats(); }