protected override void InitializeObj(Transform parent) { base.InitializeObj(parent); this.backPackGridObj = this.m_TransFrom.Find(backPackGridPath.Path); this.moreInfoTextObj = this.m_TransFrom.Find(moreInfoTextPath.Path); this.moreInfoSpriteObj = this.m_TransFrom.Find(moreInfoSpritePath.Path); Assert.IsTrue(this.moreInfoTextObj && this.moreInfoSpriteObj && this.backPackGridObj); this.itemInfoUi = new ItemInfoUI(); //恢复背包信息 this.slots = backPackGridObj.GetComponentsInChildren <Slot>(); for (int i = 0; i < slots.Length; i++) { slots[i].index = i; } foreach (var item in this.ItemList) { AddItem(item.itemId, item.count); } //LayoutRebuilder.ForceRebuildLayoutImmediate(挂载HorizontalLayoutGroup的物体的RectTransform); Debug.Log("Load: slots.Length:" + slots.Length); }
public Store(GameManager gameManager, GameDevice gameDevice) { modeType = ModeType.No; this.gameDevice = gameDevice; this.gameManager = gameManager; input = gameDevice.InputState; renderer = gameDevice.Renderer; itemManager = gameManager.ItemManager; playerInventory = gameManager.PlayerItem; totalPrice = 0; isInventoryFullMessege = false; isNoMoney = false; windowWidth = Def.WindowDef.WINDOW_WIDTH; windowHeight = Def.WindowDef.WINDOW_HEIGHT; buttonWidht = windowWidth / 2 - 128; messegeWindow = new Window(gameDevice, new Vector2(windowWidth / 4, windowHeight / 2 - 10), new Vector2(windowWidth / 2, 720 / 12)); buttonPosition = new Vector2(windowWidth - 64, windowHeight - 64); buttonWindow = new Window(gameDevice, buttonPosition, new Vector2(64, 32)); button = new Button(buttonPosition, 64, 32); hintInfo = new ItemInfoUI(Vector2.Zero, gameManager, gameDevice); }
void Start() { infoPanel = GameObject.FindGameObjectWithTag("ItemInfo").GetComponent <ItemInfoUI>(); inventoryUI = transform.parent.GetComponent <InventoryUI>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); }
public UpgradeStore(IScene town, GameManager gameManager, GameDevice gameDevice) { this.gameDevice = gameDevice; this.gameManager = gameManager; renderer = gameDevice.Renderer; input = gameDevice.InputState; blurEffect = renderer.EffectManager.GetBlurEffect(); townScene = town; inventory = gameManager.PlayerItem; itemManager = new ItemManager(); windowWidth = Def.WindowDef.WINDOW_WIDTH; windowHeight = Def.WindowDef.WINDOW_HEIGHT; selectItemInfoUI = new ItemInfoUI(new Vector2(windowWidth / 2 + 64, 96), gameManager, gameDevice); upgradeItemInfoUI = new ItemInfoUI(new Vector2(windowWidth / 2 + 64, 224 + 32), gameManager, gameDevice); leftPageLeftWindow = new Window(gameDevice, new Vector2(windowWidth / 4 - 64 - 64, windowHeight - 96), new Vector2(64, 32)); leftPageLeftWindow.Initialize(); leftPageRightWindow = new Window(gameDevice, new Vector2(windowWidth / 4 + 64, windowHeight - 96), new Vector2(64, 32)); leftPageRightWindow.Initialize(); leftPageLeftButton = new Button(leftPageLeftWindow.GetOffsetPosition(), 64, 32); leftPageRightButton = new Button(leftPageRightWindow.GetOffsetPosition(), 64, 32); }
protected override void Load() { Create(DirPath.PanelDir + Const.PanelName.packagePanel); this.itemList = Global.GlobalVar.G_Player.itemList; this.backPackGridObj = this.m_TransFrom.Find("Image_BackGround/Image_BackPackGrid"); this.moreInfoTextObj = this.m_TransFrom.Find("Image_BackGround/Image_MoreInfo/Image_TextBackGround/Text"); this.moreInfoSpriteObj = this.m_TransFrom.Find("Image_BackGround/Image_MoreInfo/Image_BigPicture"); Assert.IsTrue(this.moreInfoTextObj && this.moreInfoSpriteObj && this.backPackGridObj); this.itemInfoUi = new ItemInfoUI(); //恢复背包信息 this.slots = backPackGridObj.GetComponentsInChildren <Slot>(); for (int i = 0; i < slots.Length; i++) { slots[i].index = i; } foreach (var item in this.itemList) { AddItem(item.itemId, item.count); } //LayoutRebuilder.ForceRebuildLayoutImmediate(挂载HorizontalLayoutGroup的物体的RectTransform); Debug.Log("Load: slots.Length:" + slots.Length); }
public void OnPointerExit(PointerEventData data) { isPointerExit = true; if (isOpenInfoUI) { isOpenInfoUI = false; ItemInfoUI.CloseItemInfoUI(); } }
void ShowMateriralInfo(GameObject go, object parameter) { CharBag.Goods goods = (CharBag.Goods)parameter; ItemInfoUI info = Instantiate(iteminfo).GetComponent <ItemInfoUI>(); info.Ini(); info.OpenItemInfo(goods); }
private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else { Destroy(gameObject); } }
public IEnumerator OpenItemInfoUI() { yield return(clickTime); if (isPointerExit) { yield break; } ItemInfoUI.OpenItemInfoUI(Item.itemDictionary[itemName], gameObject.transform.position); isOpenInfoUI = true; yield break; }
private void Awake() { //单例 _instance = this; //装载数据 Load(); //获取ItemInfo物体上的ItemInfoUI组件,通过public方式获取会造成空指针异常?未解之谜?! ItemInfoUI = GameObject.Find("ItemInfo").GetComponent <ItemInfoUI>(); DragItemUI = GameObject.Find("DragItem").GetComponent <DragItemUI>(); //添加事件监听 GridUI.OnEnter = GridUI_OnEnter; GridUI.OnExit = GridUI_OnExit; GridUI.OnLeftBeginDrag = GridUI_OnLeftBeginDrag; GridUI.OnLeftEndDrag = GridUI_OnLeftEndDrag; }
public Depot(IScene town, GameManager gameManager, GameDevice gameDevice) { this.gameDevice = gameDevice; this.gameManager = gameManager; renderer = gameDevice.Renderer; input = gameDevice.InputState; blurEffect = renderer.EffectManager.GetBlurEffect(); townScene = town; mode = DepotModeType.select; inventory = gameManager.PlayerItem; itemManager = new ItemManager(); windowWidth = Def.WindowDef.WINDOW_WIDTH; windowHeight = Def.WindowDef.WINDOW_HEIGHT; hintInfo = new ItemInfoUI(Vector2.Zero, gameManager, gameDevice); }
void Start() { itemInfoUI = ItemInfoUI.instance; }
void Awake() { OriginalItem = GetComponent <ItemInfoUI>(); }
void Awake() { instance = this; }
void Awake() { self = GameObject.Find("ItemInfo"); itemInfoUI = this; }