public async Task <EquipmentUI> GetEquipmentModelById(int id) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { var sql = Sql.SqlQueryCach["Equipment.GetCheckListsByEquipmentId"]; var result = (await conn .QueryAsync <CheckListEquipment, EquipmentModel, Equipment, CheckListEquipment>( sql, (ce, em, equipment) => { em.Equipment = equipment; ce.EquipmentModel = em; return(ce); }, new { equipment_model_id = id })).ToArray(); var ret = new EquipmentUI(); if (result.Any()) { var first = result.FirstOrDefault(); ret.Id = first.EquipmentModel.Id; ret.Equipment = first.EquipmentModel.Equipment; } else { ret = null; } return(ret); } }
void Awake() { InvUI = FindObjectOfType(typeof(InventoryUI)) as InventoryUI; //Get the Inventory Manager object/script. CustomEvents = FindObjectOfType(typeof(InventoryEvents)) as InventoryEvents; EqUI = FindObjectOfType(typeof(EquipmentUI)) as EquipmentUI; MyTransform = gameObject.transform; //Set the object tranform. if (SaveAndLoad == true) { LoadEquipments(); } for (int i = 0; i < EquipmentSlots.Length; i++) //Starting a loop in the slots of the bag. { if (EquipmentSlots[i].IsTaken == true) { Item ItemScript = EquipmentSlots[i].Item.GetComponent <Item>(); //Getting the item script. EquipmentSlots[i].Icon.color = new Color(1.0f, 1.0f, 1.0f, 1.0f); EquipmentSlots[i].Icon.sprite = ItemScript.Icon; } else { EquipmentSlots[i].Icon.sprite = null; EquipmentSlots[i].Icon.color = new Color(1.0f, 1.0f, 1.0f, 0.0f); } EquipmentSlots[i].Icon.gameObject.GetComponent <SlotUI>().SlotID = i; EquipmentSlots[i].Icon.gameObject.SetActive(true); } }
public async Task <EquipmentUI> AddOrUpdateEquipment(EquipmentUI ces) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { if (ces.Id == 0) { //insert new EquipmentModel, get Id var em = new EquipmentModel { ModelId = ces.ModelId, EquipmentId = ces.Equipment.Id, ParentId = ces.ParentId, IsMark = ces.IsMark }; var mr = new ModelRepository(_logger); em = await mr.AddEquipmentToModel(em); ces.Id = em.Id; } else { var mr = new ModelRepository(_logger); await mr.UpdateEquipment(new EquipmentModel { EquipmentId = ces.Equipment.Id, Id = ces.Id, IsMark = ces.IsMark }); } var shit = await GetEquipmentModelById(ces.Id); return(shit); } }
public void LoadToEquipment(EquipmentUI _equipment, ItemsDataBase _itemsDataBase) { foreach (ItemDefensiveStatsSaveData itemData in itemDefensives) { Item toAdd = LoadDefensiveItem(itemData, _itemsDataBase); if (toAdd != null && toAdd.isSaved) { _equipment.EquipItemTo(toAdd, toAdd.slotIndex); } } foreach (ItemOffensiveStatsSaveData itemData in itemOffensives) { Item toAdd = LoadOffensiveItem(itemData, _itemsDataBase); if (toAdd != null && toAdd.isSaved) { _equipment.EquipItemTo(toAdd, toAdd.slotIndex); } } foreach (ItemCapacitySaveData itemData in itemCapacities) { Item toAdd = LoadCapacityItem(itemData, _itemsDataBase); if (toAdd != null && toAdd.isSaved) { _equipment.EquipItemTo(toAdd, toAdd.slotIndex); } } }
void Awake() { InvManager = FindObjectOfType(typeof(InventoryManager)) as InventoryManager; //Get the Inventory Manager object/script. InvEquipment = FindObjectOfType(typeof(Equipment)) as Equipment; //Get the Equipment script. InvSkillBar = FindObjectOfType(typeof(SkillBar)) as SkillBar; //Get the skill bar script. CustomEvents = FindObjectOfType(typeof(InventoryEvents)) as InventoryEvents; InvVendor = FindObjectOfType(typeof(VendorUI)) as VendorUI; InvCraft = FindObjectOfType(typeof(CraftManager)) as CraftManager; InvContainer = FindObjectOfType(typeof(ContainerUI)) as ContainerUI; InvEquipmentUI = FindObjectOfType(typeof(EquipmentUI)) as EquipmentUI; InvItemGroup = FindObjectOfType(typeof(ItemGroupUI)) as ItemGroupUI; //Setting up rect transforms: UICanvasTrans = UICanvas.GetComponent <RectTransform>(); PanelTrans = Panel.GetComponent <RectTransform>(); SetInvPosition(); // Set the default position of the inventory backdrop. CreateRiches(); //Set all riches slots. ActionMenu.gameObject.SetActive(false); DropMenu.gameObject.SetActive(false); ShowInv = false; // Panel.SetActive(false); //--hide at start }
public EquipmentSaveData(EquipmentUI _equipment) { List <ItemDefensiveStatsSaveData> itemDefList = new List <ItemDefensiveStatsSaveData>(); List <ItemOffensiveStatsSaveData> itemOffList = new List <ItemOffensiveStatsSaveData>(); List <ItemCapacitySaveData> itemCapList = new List <ItemCapacitySaveData>(); foreach (EquipmentSlot slot in _equipment.slots) { Item item = slot.item; if (item != null) { if (item is Item_DefensiveStats) { Item_DefensiveStats itemDef = item as Item_DefensiveStats; itemDefList.Add(itemDef.ToSaveData()); } else if (item is Item_OffensiveStats) { Item_OffensiveStats itemOff = item as Item_OffensiveStats; itemOffList.Add(itemOff.ToSaveData()); } else if (item is Item_Skill) { Item_Skill itemOff = item as Item_Skill; itemCapList.Add(itemOff.ToSaveData()); } } } itemDefensives = itemDefList.ToArray(); itemOffensives = itemOffList.ToArray(); itemCapacities = itemCapList.ToArray(); }
void Start() { inventory = Inventory.instance; equipmentUI = EquipmentUI.instance; int numSlots = System.Enum.GetNames(typeof(EquipmentSlot)).Length; currentEquipment = new Item[numSlots]; }
private void Awake() { if (instance != null) { return; } instance = this; }
public async Task <JsonResult> AddUpdateEquipment([FromBody] EquipmentUI ces) { await CheckPermission(); var er = new EquipmentRepository(_logger); var ret = await er.AddOrUpdateEquipment(ces); return(Json(ret)); }
public override void Use() { base.Use(); Debug.Log("You have equiped a " + this.name); equipmentUI = EquipmentUI.instance; equipmentUI.AddItem(this); EquipmentManager.instance.Equip(this); RemoveFromInventory(); }
void Start() { inventory = Inventory.instance; int numSlots = System.Enum.GetNames(typeof(EquipmentSlot)).Length; //Gets the length of our equipment slots enum currentEquipment = new Equipment[numSlots]; equipmentUI = FindObjectOfType <EquipmentUI>(); }
private void Awake() { if (Instance != null) { Debug.LogError("More than one instance of EquipmentUI found!"); return; } Instance = this; }
void Start() { equipmentUI = EquipmentUI.instance; inventory = Inventory.instance; int numSlots = System.Enum.GetNames(typeof(EquipmentSlots)).Length; currentEquipment = new Equipment[numSlots]; currentMeshes = new SkinnedMeshRenderer[numSlots]; EquipDefaultItems(); }
void Awake() { InvUI = FindObjectOfType(typeof(InventoryUI)) as InventoryUI; VendorPanel = FindObjectOfType(typeof(VendorUI)) as VendorUI; SkillBarPanel = FindObjectOfType(typeof(SkillBarUI)) as SkillBarUI; EquipmentPanel = FindObjectOfType(typeof(EquipmentUI)) as EquipmentUI; InvContainer = FindObjectOfType(typeof(ContainerUI)) as ContainerUI; InvCraft = FindObjectOfType(typeof(CraftUI)) as CraftUI; InvItemGroup = FindObjectOfType(typeof(ItemGroupUI)) as ItemGroupUI; HoverScript = FindObjectOfType(typeof(HoverItem)) as HoverItem; }
//public Dictionary<TMP_Dropdown, string> selected_equipment = new Dictionary<TMP_Dropdown, string>(); void Awake() { if (I == null) { I = this; } else { Destroy(gameObject); } }
void Awake() { _instance = this; tween = this.GetComponent <TweenPosition>(); heargear = transform.Find("headgear").gameObject; armor = transform.Find("armor").gameObject; righthand = transform.Find("right-hand").gameObject; lefthand = transform.Find("left-hand").gameObject; shoe = transform.Find("shoe").gameObject; accessoty = transform.Find("accessory").gameObject; }
void Awake() { _instance = this; tween = GetComponent <TweenPosition>(); head = transform.Find("Head").gameObject; armor = transform.Find("Armor").gameObject; rightHand = transform.Find("RightHand").gameObject; leftHand = transform.Find("LeftHand").gameObject; shoe = transform.Find("Shoe").gameObject; accessory = transform.Find("Accessory").gameObject; playerStatus = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerStatus>(); }
public PlayerEquipment() { m_EquipmentUI = PlayerManager.Instance.EquipmentUI; m_PlayerStats = PlayerManager.Instance.PlayerStats; m_EquipmentSlots = new Dictionary <EquipmentSlotId, Equipment> { { EquipmentSlotId.Head, null }, { EquipmentSlotId.Torso, null }, { EquipmentSlotId.Legs, null }, { EquipmentSlotId.Weapon, null }, }; }
void Awake() { if (instance != null) { Debug.Log("EquipManager on " + gameObject.name); Debug.LogWarning("More than 1 EquipManger"); return; } //EquipManger.instance.onEquipmentChanged += UpdateUI; PlayerManager.instance.onPlayerLoad += UpdateUI; instance = this; //EquipManger.instance.onEquipmentChanged += UpdateUI; }
private void Awake() { instance = this; gameObject.SetActive(false); pi = GameObject.FindGameObjectWithTag(Tags.Player.ToString()).GetComponent <PlayerInfo>(); headgear = transform.Find("Headgear").gameObject; armor = transform.Find("Armor").gameObject; leftHand = transform.Find("LeftHand").gameObject; rightHand = transform.Find("RightHand").gameObject; shoe = transform.Find("Shoe").gameObject; accessory = transform.Find("Accessory").gameObject; }
private void Awake() { _instance = this; equipmentUI = GetComponent <UIPositionMove>(); //获取装备格子 headgear = transform.Find("Headgear").gameObject; armor = transform.Find("Armor").gameObject; leftHand = transform.Find("LeftHand").gameObject; rightHand = transform.Find("RightHand").gameObject; shoe = transform.Find("Shoe").gameObject; accessory = transform.Find("Accessory").gameObject; }
Inventory inventory; // Reference to our inventory void Start() { equipmentUI = EquipmentUI.instance; inventory = Inventory.instance; // Get a reference to our inventory // Initialize currentEquipment based on number of equipment slots int numSlots = System.Enum.GetNames(typeof(EquipmentSlot)).Length; currentEquipment = new Equipment[numSlots]; currentMeshes = new SkinnedMeshRenderer[numSlots]; EquipDefaults(); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); gameObject.SetActive(false); } else if (instance != this) { Destroy(gameObject); } }
public static void SaveEquipement(EquipmentUI _equipment) { if (!Directory.Exists(SAVE_PATH)) { Directory.CreateDirectory(SAVE_PATH); } BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(SAVE_PATH + EQUIPMENT_FILE, FileMode.Create); EquipmentSaveData equipData = new EquipmentSaveData(_equipment); bf.Serialize(file, equipData); file.Close(); }
public static void LoadEquipment(EquipmentUI _equipment, ItemsDataBase _itemsDataBase) { if (File.Exists(SAVE_PATH + EQUIPMENT_FILE)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(SAVE_PATH + EQUIPMENT_FILE, FileMode.Open); EquipmentSaveData equipData = bf.Deserialize(file) as EquipmentSaveData; equipData.LoadToEquipment(_equipment, _itemsDataBase); file.Close(); } }
private void Start() { gameManager = GameManager.Singleton; hudManager = HudManager.Singleton; inventoryUI = hudManager.inventoryUI; equipmentUI = hudManager.equipmentUI; merchantHUD = hudManager.merchantHUD; storageChestUI = hudManager.storageChestUI; player = gameManager.Player; playerInteract = player.GetComponent <PlayerInteract>(); inventory = player.GetComponentInChildren <Inventory>(); state = InputState.PlayerControl; }
void Start() { if (SceneManager.GetActiveScene().name == "SandBox") { SandBoxUI.InitUI(this); EquipmentUI.InitUI(this); PitchingUI.InitUI(this); } else if (SceneManager.GetActiveScene().name == "Equipment") { EquipmentUI.InitUI(this); SandBoxUI.InitUI(this); PitchingUI.InitUI(this); } else { PitchingUI.InitUI(this); EquipmentUI.InitUI(this); SandBoxUI.InitUI(this); } }
private void Awake() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCharacter>(); parentObj = GameObject.FindGameObjectWithTag("CharacterCanvas"); expandParent = GameObject.FindGameObjectWithTag("CharacterCanvasExpanded"); apChangesParent = GameObject.FindGameObjectWithTag("APChanges"); characterName = GameObject.FindGameObjectWithTag("CharacterInfoName").GetComponent <TextMeshProUGUI>(); remainingAP = GameObject.FindGameObjectWithTag("RemainingAP").GetComponent <TextMeshProUGUI>(); dmgRange = GameObject.FindGameObjectWithTag("DamageRange").GetComponent <TextMeshProUGUI>(); strAmountText = GameObject.FindGameObjectWithTag("StrAmount").GetComponent <TextMeshProUGUI>(); dexAmountText = GameObject.FindGameObjectWithTag("DexAmount").GetComponent <TextMeshProUGUI>(); intAmountText = GameObject.FindGameObjectWithTag("IntAmount").GetComponent <TextMeshProUGUI>(); lukAmountText = GameObject.FindGameObjectWithTag("LukAmount").GetComponent <TextMeshProUGUI>(); weaponEquip = GameObject.FindGameObjectWithTag("EquipWeapon").GetComponent <EquipmentUI>(); topEquip = GameObject.FindGameObjectWithTag("EquipBody").GetComponent <EquipmentUI>(); headEquip = GameObject.FindGameObjectWithTag("EquipHead").GetComponent <EquipmentUI>(); bottomEquip = GameObject.FindGameObjectWithTag("EquipBottom").GetComponent <EquipmentUI>(); }
void Awake() { mInstance = this; tween=this.GetComponent<UITweenPos>(); headgear = transform.Find("HeadGear").gameObject; armor = transform.Find("Armor").gameObject; rightHand = transform.Find("RightHand").gameObject; leftHand = transform.Find("LeftHand").gameObject; shoe = transform.Find("Shoe").gameObject; accessory = transform.Find("Accessory").gameObject; ps = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<PlayerStatus>(); }
void OnDestroy() { mInstance = null; }
public override void Start () { base.Start (); this.GetComponent<Image> ().sprite = unequippedBackground; eUI = GetComponentInParent<EquipmentUI> (); }
void Awake() { instance = this; }
void Awake() { equipmentUI = (EquipmentUI)FindObjectOfType(typeof(EquipmentUI)); }
void Awake() { instance = this; manager = EquipmentManager.instance; }