public void selectWeap(ShopWeaponList page) { Color tempcol; for (int i = 0; i < WeapList.Count; ++i) { if (page.getWeapWifIndex() == WeapList[i]) { currentWeapon = page.getWeapWifIndex(); currentWeaponIndex = i; tempcol = WeapList[i].button.image.color; tempcol.a = 1; WeapList[i].button.image.color = tempcol; MultipurposeButton.image.enabled = true; runUpdateSlider = false; updateSlider(); updateInfo(); } else { tempcol = WeapList[i].button.image.color; tempcol.a = 0.4f; WeapList[i].button.image.color = tempcol; } } }
public void addWeapToList(ShopWeapon weab) { WeapList.Add(weab); Color tempcol; tempcol = weab.button.image.color; tempcol.a = 0.4f; weab.button.image.color = tempcol; }
void PopulateList() { foreach (var weap in weapItems) { GameObject newButton = Instantiate(sampleWeapon) as GameObject; ShopWeapon button = newButton.GetComponent <ShopWeapon> (); button.priceTag.text = "$" + weap.price; button.name = weap.name; button.icon.sprite = weap.icon; button.price = weap.price; button.damage = weap.damage; button.fireRate = weap.fireRate; button.clipSize = weap.clipSize; button.purchased = weap.purchased; button.button.onClick = weap.onClick; newButton.transform.SetParent(contentPanel); newButton.GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 1f); newButton.transform.localPosition = new Vector3(newButton.transform.localPosition.x, newButton.transform.localPosition.y, 0); weapList.Add(newButton.GetComponent <ShopWeapon> ()); shopHandler.addWeapToList(newButton.GetComponent <ShopWeapon> ()); } /* * Color tempcol; * tempcol = GOS [0].button.image.color; * tempcol.a = 1; * GOS [0].button.image.color = tempcol; */ }
void Awake() { instance = this; tween = GetComponent <TweenPosition>(); numberDialog = transform.Find("NumberDialog").gameObject; numberInput = transform.Find("NumberDialog/NumberInput").GetComponent <UIInput>(); numberDialog.SetActive(false); }
static int set_Instance(IntPtr L) { try { ShopWeapon arg0 = (ShopWeapon)ToLua.CheckUnityObject(L, 2, typeof(ShopWeapon)); ShopWeapon.Instance = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void unequipWeap() { for (int i = 0; i < weapWheel.Count; ++i) { if (currentWeapon == weapWheel[i]) { currentWeapon.equiped = false; weapWheel[i] = new ShopWeapon(); weapWheelImg [i].sprite = new Sprite(); weapWheelImg [i].color = new Color(1, 1, 1, 0); updateInfo(); } } }
static int get_weaponIdArray(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ShopWeapon obj = (ShopWeapon)o; int[] ret = obj.weaponIdArray; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index weaponIdArray on a nil value" : e.Message)); } }
static int Instan(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); ShopWeapon obj = (ShopWeapon)ToLua.CheckObject(L, 1, typeof(ShopWeapon)); UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.GameObject)); UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 3, typeof(UnityEngine.GameObject)); UnityEngine.Object[] arg2 = ToLua.CheckObjectArray <UnityEngine.Object>(L, 4); obj.Instan(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_weaponIdArray(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ShopWeapon obj = (ShopWeapon)o; int[] arg0 = ToLua.CheckNumberArray <int>(L, 2); obj.weaponIdArray = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index weaponIdArray on a nil value" : e.Message)); } }
public void selectWeap (ShopWeaponList page) { Color tempcol; for (int i = 0; i < WeapList.Count; ++i) { if(page.getWeapWifIndex() == WeapList[i]) { currentWeapon = page.getWeapWifIndex(); currentWeaponIndex = i; tempcol = WeapList[i].button.image.color; tempcol.a = 1; WeapList[i].button.image.color = tempcol; MultipurposeButton.image.enabled = true; runUpdateSlider = false; updateSlider(); updateInfo (); } else { tempcol = WeapList[i].button.image.color; tempcol.a = 0.4f; WeapList[i].button.image.color = tempcol; } } }
public UIMenu GetMenu() { var weapons = new UIMenu("Weapon Shop", "Customize your weapons"); ShopWeapon[] items = new ShopWeapon[] { new ShopWeapon("Combat PDW", WeaponHash.CombatPDW, 1000, 100, 30), new ShopWeapon("Pump Shotgun MK II", WeaponHash.PumpShotgunMk2, 1000, 100, 8), new ShopWeapon("Assault Rifle", WeaponHash.AssaultRifle, 1000, 100, 30), }; foreach (var item in items) { weapons.AddItem(item.GetUIMenuItem()); } weapons.OnItemSelect += (sender, selectedItem, index) => { foreach (var item in items) { if (item.GetUIMenuItem().Text == selectedItem.Text) { WeaponPurchaseMenu.ApplyToMenu(item, UIController.WeaponPurchase); UIController.WeaponPurchase.Visible = true; weapons.Visible = false; } } }; weapons.OnMenuClose += sender => { UIController.MainMenu.Visible = true; }; return(weapons); }
public void unequipWeap () { for (int i = 0; i < weapWheel.Count; ++i) { if(currentWeapon == weapWheel[i]) { currentWeapon.equiped = false; weapWheel[i] = new ShopWeapon(); weapWheelImg [i].sprite = new Sprite(); weapWheelImg [i].color = new Color(1,1,1,0); updateInfo (); } } }
private void Awake() { _instance = this; shopWeapon = GetComponent <UIPositionMove>(); }
public static void ApplyToMenu(ShopWeapon shopWeapon, UIMenu weapons) { var player = Game.Player; weapons.Clear(); var purchaseWeapon = new UIMenuItem("Purchase " + shopWeapon.Name + " - $" + shopWeapon.Price); weapons.AddItem(purchaseWeapon); var purchaseAmmo = new UIMenuItem("Purchase " + shopWeapon.AmmoSize + " bullets - $" + shopWeapon.AmmoPrice); weapons.AddItem(purchaseAmmo); weapons.OnItemSelect += (sender, item, index) => { if (item == purchaseWeapon) { if (player.Character.Weapons.HasWeapon(shopWeapon.Hash)) { UI.Notify("You already have this weapon."); } else { if (shopWeapon.Price > Game.Player.Money) { UI.Notify("Not enough money!"); } else { player.Character.Weapons.Give(shopWeapon.Hash, shopWeapon.AmmoSize, false, false); if (player.Character.Weapons[shopWeapon.Hash].Ammo > shopWeapon.AmmoSize) { player.Character.Weapons[shopWeapon.Hash].Ammo = shopWeapon.AmmoSize; //player.Character.Weapons[shopWeapon.Hash].SetComponent(WeaponComponent.assaultrifle); } Game.Player.Money -= shopWeapon.Price; } } } else if (item == purchaseAmmo) { if (!player.Character.Weapons.HasWeapon(shopWeapon.Hash)) { UI.Notify("You need to purchase this weapon first."); } else { if (shopWeapon.AmmoPrice > Game.Player.Money) { UI.Notify("Not enough money!"); } else { player.Character.Weapons[shopWeapon.Hash].Ammo += shopWeapon.AmmoSize; Game.Player.Money -= shopWeapon.AmmoPrice; } } } }; weapons.OnMenuClose += sender => { UIController.WeaponShop.Visible = true; }; }
public WeaponPurchaseMenu(ShopWeapon _shopWeapon) { shopWeapon = _shopWeapon; }