public static ItemBox InstantiateFromTemplate(ItemDisplayProxy itemDisplayProxy) { ItemBox itemBox = Prefabulator.CreatePrefabInstance <ItemBox>(PathMaster.ResourcesRelativeGenerateFolder, "ItemBox"); itemBox.itemDisplayProxy = itemDisplayProxy; return(itemBox); }
// Start is called before the first frame update void Start() { //Check if there is already an instance of SoundManager if (instance == null) { //if not, set it to this. instance = this; } //If instance already exists: else if (instance != this) { //Destroy this, this enforces our singleton pattern so there can only be one instance of SoundManager. Destroy(gameObject); BoltConsole.Write("ItemBox copy destroyed"); } gamestate = GameObject.Find("GameState(Clone)").GetComponent <NetworkGameState>(); localPlayer = GameObject.FindGameObjectWithTag("LocalPlayer").GetComponent <Player>(); itemForGrabsStr = gamestate.ItemForGrabs(); if (itemForGrabsStr != null && !itemForGrabsStr.Equals("")) { textStatus.text = yesItemHere; itemObjNetwork = ItemList.instance.GetItemFromName(itemForGrabsStr); itemSlotButton.onClick.AddListener(() => inventory.ShowThirdPartyItemInfo(itemObjNetwork)); itemForGrabsImage.sprite = itemObjNetwork.sprite; itemForGrabsImage.enabled = true; } else { textStatus.text = noItemHere; } }
/// <summary> /// Remove both the display and the GameObject of the item. /// </summary> /// <param name="item">The item to remove.</param> public void Remove(Item item) { ItemBox boxToRemove = null; foreach (var box in itemBoxs) { if (box.item == item) { Destroy(box.gameObject); boxToRemove = box; } } if (boxToRemove) { itemBoxs.Remove(boxToRemove); } for (int i = 0; i < elementContainer.transform.childCount; i++) { GameObject child = elementContainer.transform.GetChild(i).gameObject; if (child.GetComponent <ItemBox>().item == item) { Destroy(child.GetComponent <ItemBox>().gameObject); } } StartCoroutine(DelayedDestroyItem(300, item)); //Destroy(item.gameObject); }
public bool Restore(string filePath, GameObject gameObject) { if (!Caches.ContainsKey(filePath)) { Debug.LogError("Restore Error! no Cache generated! filePath = " + filePath); return(false); } gameObject.SetActive(false); if (((FWNetworkManager)FWNetworkManager.singleton).isServer) { Enemy enemy = gameObject.GetComponent <Enemy>(); if (enemy != null) { enemy.RpcSetActive(false); } Bullet bullet = gameObject.GetComponent <Bullet>(); if (bullet != null) { bullet.RpcSetActive(false); } ItemBox item = gameObject.GetComponent <ItemBox>(); if (item != null) { item.RpcSetActive(false); } } Caches[filePath].Enqueue(gameObject); return(true); }
public void HoldingItem(int index) { ItemBox itemBox = GetComponent <ItemBox>(); Item item = itemBox.AccessItem(index); if (item != null) { if (holdingItemIndex != -1) { UnityEngine.Object.Destroy(holdingItem); } holdingItemIndex = index; holdingItem = item.GetModel(); Vector3 itemScale = Vector3.zero + holdingItem.transform.localScale; holdingItem.transform.parent = rightHand.transform; holdingItem.layer = rightHand.layer; holdingItem.transform.localPosition = new Vector3(0.45f, -0.45f, -0.2f); holdingItem.transform.localEulerAngles = Vector3.zero; holdingItem.transform.localScale = new Vector3( itemScale.x / rightHand.transform.localScale.x, itemScale.y / rightHand.transform.localScale.y, itemScale.z / rightHand.transform.localScale.z); holdingItem.GetComponent <Animation>().Stop(); } }
public void Remove(ItemBox box) { if (mItemBox.Remove(box.mID)) { GameObject.Destroy(box.gameObject); } }
public ItemBoxUpdatedEventArgs(ItemBox box) { consumables = box.Consumables; ammo = box.Ammo; materials = box.Materials; decorations = box.Decorations; }
private void AddItem(object sender, RoutedEventArgs e) { if (ItemBox.Text != "" || PriceBox.Text != "") { float price = 0; price = Convert.ToUInt64(PriceBox.Text); using (var context = new LoginDBEntities()) { var product = new ProductFromPeople() { UserName = Person.Login, ProductName = ItemBox.Text, Price = price }; context.ProductFromPeoples.Add(product); context.SaveChanges(); ItemBox.Clear(); PriceBox.Clear(); MessageBox.Show("Wait , when admin to add your thing to the main list"); } } else { MessageBox.Show("Incorrect"); } }
//----------当个ItemBox行为 /// <summary> /// 进入ItemBox //切换 /// </summary> private void itemBox_Enter(object sender, EventArgs e) { ItemBox ib = sender as ItemBox; nowSelectItemBox = ib; if (ib.Tag != null) { if (isItemMode(nowSeMode)) { if (ib.Tag != null) { SetItemIntroduce(ib.Tag.ToString()); } } else if (nowSeMode is XiaoChaoMode) { ZIKU.DataBase.XiaoChao xc = ZIKU.DataBase.XiaoChao.getInstance(ib.Tag.ToString()); if (xc != null) { title_Label.Text = xc.name; ItemIntroduce.Text = xc.introduce; } } } }
private void Awake() { if (instance == null) { instance = this; } }
/// <summary> /// 执行if框 /// </summary> /// <param name="box"></param> /// <returns></returns> protected void DoIfFunction(ItemBox box, WriteStreamCallBack wrs, IScriptLayout ml) { ScriptInput si = new ScriptInput(); foreach (var item in box.InputDatas) { if (item.PIEnum != ParaItemEnum.INPUT) { si.SetValue(item.Name, GetValue(item as ParatItem)); } } //检测是否需要断点停止 checkScriptRunForStopPoint(box, si, null); if (Convert.ToBoolean(si.GetFirst())) { RunningFunction((box as ItemBox).Children[0], wrs, ml); } else { RunningFunction((box as ItemBox).Children[1], wrs, ml); } si.Dispose(); si = null; }
public void Initialize(UIManager uiManager, GameObject player) { mManager = uiManager; this.player = player; this.itemLibrary = uiManager.allManager.itemLibrary; gameObject.SetActive(false); this.itemBox = player.GetComponent <ItemBox>(); itemNum = itemBox.maxItemNum; buttonList = new ItemButton[itemNum]; selectedItem = -1; chosenItem = -1; emptyItemSprite = Resources.Load <Sprite>(emptyImagePath); chosenItemSprite = Resources.Load <Sprite>(chosenImagePath); selectedItemSprite = Resources.Load <Sprite>(selectedImagePath); string buttonName = "itemButton "; for (int i = 0; i < itemNum; i++) { buttonList[i] = transform.Find(buttonName + "(" + i + ")").gameObject.GetComponent <ItemButton>(); if (buttonList[i] != null) { buttonList[i].Initialize(this, itemLibrary, itemBox.itemList[i], i); } } }
public static void Test() { ItemBox box = Gui.Instance.CreateWidget <ItemBox>("ItemBox", new IntCoord(20, 320, 100, 100), Align.Default, "Main"); box.EventNotifyItem += new ItemBox.HandleNotifyItem(box_EventNotifyItem); box.EventMouseItemActivate += new ItemBox.HandleMouseItemActivate(box_EventMouseItemActivate); box.EventChangeItemPosition += new ItemBox.HandleChangeItemPosition(box_EventChangeItemPosition); box.EventSelectItemAccept += new ItemBox.HandleSelectItemAccept(box_EventSelectItemAccept); box.RequestDrawItem += new ItemBox.HandleDrawItem(box_RequestDrawItem); box.RequestCoordItem += new ItemBox.HandleCoordItem(box_RequestCoordItem); box.RequestCreateWidgetItem += new ItemBox.HandleCreateWidgetItem(box_RequestCreateWidgetItem); box.AddItem("cell0"); box.ResetDrag(); Widget cell = box.GetWidgetByIndex(0); uint index = box.GetIndexByWidget(cell); Widget drag = box.GetWidgetDrag(); box.VerticalAlignment = !box.VerticalAlignment; box.ClearItemDataAt(0); box.SetItemDataAt(0, "new cell0"); box.ClearIndexSelected(); box.IndexSelected = 0; box.RedrawAllItems(); box.RedrawItemAt(0); box.RemoveItemAt(0); box.RemoveAllItems(); box.AddItem("cell0"); box.SetItemDataAt(0, "new cell0"); box.InsertItemAt(0, "insert cell0"); uint count = box.ItemCount; }
private void Save_but_Click(object sender, EventArgs e) { if (MainForm.KeyExists("Programs")) { key.SetValue("Programs", ""); } for (int i = 0; i < ItemBox.Items.Count; i++) { string check; if (ItemBox.GetItemChecked(i)) { check = "TRUE"; } else { check = "FALSE"; } key.SetValue("Programs", key.GetValue("Programs").ToString() + ItemBox.Items[i] + "," + tmpprocesslist[i] + "," + check + ";"); //File.AppendAllText(@"C:\Windows\System32\drivers\etc\Programs.begeba", ItemBox.Items[i] + "," + tmpprocesslist[i] + "," + check + ";"); } Program.CreateProgramArray(); MainForm.CreateProgramArray(Program.checkedState, Program.processList); key.SetValue("ProgramsChanged", "TRUE"); MessageBox.Show("Ændringerne er gemt", "ADVARSEL", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/* * Method : GrabTotalBtn_Click * Returns : none * Parameters : none * Description : grabs the total of the selected items the user wishes to purchase * : it also grabs the region, and passes all of that information to the * : PurchaseTotaller to send to the service. */ private void GrabTotalBtn_Click(object sender, EventArgs e) { double totalItemPrice = 0; string regionCode = ""; List <double> itemCosts = new List <double>() { 8.25, 2.99, 3.99, 5.00 }; itemTotal.Text = ""; hstTotal.Text = ""; pstTotal.Text = ""; gstTotal.Text = ""; totalPrice.Text = ""; if (regionCheck.CheckedItems.Count != minimum) { regionCode = regionCheck.CheckedItems[firstIndex].ToString(); } for (int i = 0; i < ItemBox.Items.Count; i++) { //check to see if the current index is checked if (ItemBox.GetItemChecked(i) == true) { //add the price of the checked item to the item total totalItemPrice += itemCosts[i]; } } Call_PurchaseTotaller(Convert.ToDouble(Pricetxt.Text), regionCode); }
private static ItemBox CreateTreasure(Transform point, string prefabPath, int rewardId, bool playActorAnim, float scale) { GameObject gameObject = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Mission, prefabPath); if (gameObject == null) { return(null); } GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject); Transform mItemBoxRoot = new GameObject("ItemBox").transform; mItemBoxRoot.parent = TransRoot.self.transform; mItemBoxRoot.localPosition = Vector3.zero; gameObject2.transform.parent = mItemBoxRoot; ItemBox component = gameObject2.GetComponent <ItemBox>(); if (component == null) { Dbgl("item box is null!"); return(null); } Dbgl("Spawning chest!"); component.name += "_cheat_a"; component.path = prefabPath; component.SetItems(rewardId, playActorAnim, scale); component.gamePos = point.position; component.transform.position = point.position; component.transform.rotation = point.rotation; return(component); }
static ItemManager() { for (int f = 0; f < boxs.Length; f++) { boxs[f] = new ItemBox(); } }
public IEnumerable <T> ReverseIterator() { for (int i = _toAdd.Count - 1; i >= 0; i--) { ItemBox box = _toAdd[i]; if (box.MarkedToRemove) { continue; } yield return(box.Item); } for (int i = _items.Count - 1; i >= 0; i--) { ItemBox box = _items[i]; if (box.MarkedToRemove) { continue; } yield return(box.Item); } }
static void box_RequestCoordItem(ItemBox _sender, ref IntCoord _coord, bool _drag) { _coord.left = 0; _coord.top = 0; _coord.width = 70; _coord.height = 70; }
public IEnumerator <T> GetEnumerator() { for (int i = 0; i < _items.Count; i++) { ItemBox box = _items[i]; if (box.MarkedToRemove) { continue; } yield return(box.Item); } for (int i = 0; i < _toAdd.Count; i++) { ItemBox box = _toAdd[i]; if (box.MarkedToRemove) { continue; } yield return(box.Item); } }
/// <summary> /// Removes and yields every item, including items added through iterator. /// </summary> public IEnumerable <T> Drain() { for (int i = 0; i < _items.Count; i++) { ItemBox box = _items[i]; if (box.MarkedToRemove) { continue; } box.MarkedToRemove = true; yield return(box.Item); } for (int i = 0; i < _toAdd.Count; i++) { ItemBox box = _toAdd[i]; if (box.MarkedToRemove) { continue; } box.MarkedToRemove = true; yield return(box.Item); } }
public void CopyTo(T[] array, int arrayIndex) { int index = 0; for (int i = 0; i < _items.Count; i++) { ItemBox box = _items[i]; if (box.MarkedToRemove) { continue; } array[arrayIndex + index] = box.Item; index += 1; } for (int i = 0; i < _toAdd.Count; i++) { ItemBox box = _toAdd[i]; if (box.MarkedToRemove) { continue; } array[arrayIndex + index] = box.Item; index += 1; } }
//abuse public void OnJoinGame(NetworkConnection conn, JoinMessage Join) { NetPlayer NP = Instantiate(playerPrefab).GetComponent <NetPlayer>(); NetworkServer.AddPlayerForConnection(conn, NP.gameObject); PlayerBrain PB = Instantiate(GamePlayer); NetworkServer.Spawn(PB.gameObject, conn); for (int i = 0; i < 25; i++) { ItemBox IB = Instantiate(ItemBox); NetworkServer.Spawn(IB.gameObject); IB.Randomize(); } for (int i = 0; i < 5; i++) { PlatBrain PlB = Instantiate(PlatGuy); PlB.transform.position = new Vector3(300, 300, 0) * Random.insideUnitCircle; NetworkServer.Spawn(PlB.gameObject); PlB.Die(); } //Players.Add(NP.netId, NP); //PlayerBrains.Add(NP.netId, PB); JoinedMessage joined = new JoinedMessage(); //Debug.Log(NP.netId+"|"+PB.netId); joined.id = NP.netId; joined.Player = PB.netId; NetworkServer.SendToAll(joined); }
private void itemBox_DragFileDrop(object obj, string[] DragFileList) { ItemBox ib = obj as ItemBox; DragFilesList = DragFileList; if (DragFileList.Length > 0) { item_SeForm = ZIKU.DataBase.Item.getInstance(ib.Tag.ToString()); if (item_SeForm != null) { SetItemIntroduce(ib.Tag.ToString()); ToolStripMenuItem itemName_Menu = new ToolStripMenuItem("项目的名称"); ToolStripMenuItem copyFiles_Menu = new ToolStripMenuItem("打开“项目资料目录”"); ToolStripMenuItem moveFiles_Menu = new ToolStripMenuItem("打开“项目资料目录”"); copyFiles_Menu.Click += CopyFiles_Menu_Click; moveFiles_Menu.Click += MoveFiles_Menu_Click; ContextMenuStrip cm = new ContextMenuStrip(); itemName_Menu.Enabled = false; itemName_Menu.Text = item_SeForm.name; cm.Items.Add(itemName_Menu); cm.Items.Add("-"); cm.Items.Add(copyFiles_Menu); cm.Items.Add(moveFiles_Menu); if (item_SeForm.iPathExpand != "") { if (Tools.checkFolderCreation(item_SeForm.iPathExpand)) { copyFiles_Menu.Enabled = true; copyFiles_Menu.Text = "复制所有文件到“项目资料目录”"; moveFiles_Menu.Enabled = true; moveFiles_Menu.Text = "移动所有文件到“项目资料目录”"; } else { copyFiles_Menu.Enabled = false; copyFiles_Menu.Text = "自定义“项目资料目录”无效"; moveFiles_Menu.Visible = false; } } else { if (Tools.checkFolderCreation(ZIKU.DataBase.Config.Instance.dataFolderExpand)) { copyFiles_Menu.Enabled = true; copyFiles_Menu.Text = "复制所有文件到“项目资料目录”"; moveFiles_Menu.Enabled = true; moveFiles_Menu.Text = "移动所有文件到“项目资料目录”"; } else { copyFiles_Menu.Enabled = false; copyFiles_Menu.Text = "“项目资料总目录”无效,请检查数据库设置"; moveFiles_Menu.Visible = false; } } cm.Show(MousePosition); } } }
private void salvarToolStripButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; ItemBox ItemSelecionado = (ItemBox)Lst_Busca.Items[Lst_Busca.SelectedIndex]; idSelect = ItemSelecionado.id; this.Close(); }
[SerializeField] Slot selectedSlot = null; //何のスロットを選んでいるのかどうかを決める private void Awake() { if (instance == null) { instance = this; slots = GetComponentsInChildren <Slot>(); //itemBoxについている子要素を取得してくれる。 } }
/// <summary> /// 创建代码块事件 /// </summary> /// <param name="data"></param> public override void DataTree_CreateCallback(IItemBox data) { ItemBox box = new ItemBox(); box.Copy(data); this.Add(box); HiddenTree(); }
void OnItemChange(int p_index, ItemBox p_box) { if (p_index == index) { iconImage.sprite = p_box.itemData.icon; count = p_box.count; } }
/// <summary> /// 鼠标点击 /// </summary> private void itemBox_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ItemBox ib = sender as ItemBox; nowSeMode.Execute(ib.Tag.ToString()); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.layer == LayerMask.NameToLayer("Box")) { if (collision.transform.position.y >= transform.position.y + 0.7f) { ItemBox box = collision.transform.GetComponent <ItemBox>(); if (box) { box.OnHeadbutted(); } } } if (collision.gameObject.layer == LayerMask.NameToLayer("Item")) { Item item = collision.transform.GetComponent <Item>(); if (item) { item.OnItemGot(this); } } // 被敌人Enemy碰到 if ((1 << collision.gameObject.layer & LayerMask.GetMask("Enemy", "Boss")) != 0) { // 如果在空中,要先检测是不是脚底踩到敌人 if (cc.curMoveStatus == MoveStatus.Air) { float w = 0.3f; if (transform.localScale.x > 1.1f) { w = 0.5f; } Collider2D[] colliders = Physics2D.OverlapBoxAll(groundCheck.position, new Vector2(w, 0.2f), 0, LayerMask.GetMask("Enemy", "Boss")); foreach (Collider2D c in colliders) { RoleDie rd = c.GetComponent <RoleDie>(); if (rd != null) { rd.Die(c.transform); // 反弹 rigid.velocity = new Vector2(rigid.velocity.x, 0); rigid.AddForce(new Vector2(0, 300)); } } if (colliders.Length > 0) { return; } } // 运行到这里说明没踩到敌人,碰撞死亡 dead = true; Invoke("ResetGame", 3); BGMusic.Instance.PlayDeadMusic(); } }
public override void OnInspectorGUI() { m_ItemBox = target as ItemBox; DrawAttr(); }
IEnumerator EffectSpawnItemBox(ItemBox itemBox, float time) { yield return new WaitForSeconds (time); itemBox.gameObject.SetActive(true); }
static void box_RequestDrawItem(ItemBox _sender, Widget _item, IBDrawItemInfo _info) { EditBox cell = _item.UserData as EditBox; string str = _sender.GetItemDataAt(_info.index) as string; if (str != null) cell.OnlyText = str; }
static void box_RequestCreateWidgetItem(ItemBox _sender, Widget _item) { EditBox cell = _item.CreateWidget<EditBox>("Edit", new IntCoord(0, 0, 50, 50), Align.Default); _item.UserData = cell; }
static void box_EventSelectItemAccept(ItemBox _sender, uint _index) { ExampleApplication.DebugOut("EventSelectItemAccept index=" + _index.ToString()); }
static void box_EventChangeItemPosition(ItemBox _sender, uint _index) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventChangeItemPosition index=" + _index.ToString()); }
static void box_EventNotifyItem(ItemBox _sender, IBNotifyItemData _info) { Export.DebugOut("EventNotifyItem notify=" + _info.notify.ToString()); }
static void box_EventMouseItemActivate(ItemBox _sender, uint _index) { Export.DebugOut("EventMouseItemActivate index=" + _index.ToString()); }
static void box_EventChangeItemPosition(ItemBox _sender, uint _index) { Export.DebugOut("EventChangeItemPosition index=" + _index.ToString()); }
static void box_EventSelectItemAccept(ItemBox _sender, uint _index) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventSelectItemAccept index=" + _index.ToString()); }
static void box_EventNotifyItem(ItemBox _sender, IBNotifyItemData _info) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventNotifyItem notify=" + _info.notify.ToString()); }
static void box_EventMouseItemActivate(ItemBox _sender, uint _index) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventMouseItemActivate index=" + _index.ToString()); }
public Element(ItemBox box, ElementData data) : base(box) { Kind = data.kind; Count = data.capacity; }
static void box_EventSelectItemAccept(ItemBox _sender, uint _index) { Export.DebugOut("EventSelectItemAccept index=" + _index.ToString()); }
// Use this for initialization void Start() { _itemBox = new ItemBox(); _gameLevel = PlayerPrefs.GetInt(CURRENT_LEVEL_KEY, 1); RectTransform rect = GetComponent<RectTransform>(); rect.anchoredPosition = Vector2.zero; gameObject.SetActive(false); }
public BombItem(ItemBox box, BombData data) : base(box) { Damage = data.damage; }
protected Item(ItemBox box) { this.box = box; }