private void OnBeginDragMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { GameObject content = null; if (mItemType == UIBuildWndItem.ItemType.mMenu) { if (mIndex >= mMenuList.Count && mIndex < 0) { return; } if (mMenuList[mIndex].mContentSprite.gameObject.activeSelf) { content = mMenuList[mIndex].mContentSprite.gameObject; } else { content = mMenuList[mIndex].mContentTexture.gameObject; } DragItem = mMenuList[mIndex]; } if (content != null) { DragObejct = GameObject.Instantiate(content) as GameObject; DragObejct.transform.parent = mDragItemContent.transform; DragObejct.transform.localScale = new Vector3(48, 48, 1); DragObejct.transform.position = Input.mousePosition; } }
void OnToolTip(bool isShow, UIBuildWndItem.ItemType _ItemType, int _Index) { if (ToolTip != null) { ToolTip(isShow, _ItemType, _Index); } }
private void MenuItemOnClick(UIBuildWndItem.ItemType _itemType, int index) { //index = (mBoxBars.PageIndex) * mBoxBars.ItemCount + index; if (_itemType == UIBuildWndItem.ItemType.mMenu && MenuItemClick != null) { MenuItemClick(index); } }
private void OnDragMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { if (DragObejct != null) { Vector3 mousePos = Input.mousePosition; DragObejct.transform.localPosition = new Vector3(mousePos.x, mousePos.y, -15); } }
void OnGetDrag(UIBuildWndItem.ItemType mItemType, int mIndex) { if (mItemType == UIBuildWndItem.ItemType.mMenu && MenuItemGetDrag != null) { mIndex = mIndex + (mBoxBars.PageIndex - 1) * mBoxBars.ItemCount; MenuItemGetDrag(mIndex); } }
void OnDragMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { //Debug.Log("OnDragMeaterItem:" + mItemType + "," + mIndex); if (mMeunControl.DragObejct != null) { Vector3 mousePos = Input.mousePosition; mMeunControl.DragObejct.transform.localPosition = new Vector3(mousePos.x, mousePos.y, -15); } }
private void OnDropMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { if (DragObejct == null) { return; } UIBuildWndItem item = QueryGetDragItem();; if (item != null) { UISprite sp = DragObejct.GetComponent <UISprite>(); if (sp != null) { item.GetDrag(DragItem.mTargetItemType, DragItem.mIndex, sp.spriteName, DragItem.atlas); } else { item.GetDrag(DragItem.mTargetItemType, DragItem.mTargetIndex, DragItem.mContentTexture.mainTexture); } if (DragItem.mItemType == UIBuildWndItem.ItemType.mMenu) { item.mTargetItemType = DragItem.mTargetItemType; item.SetItemID(DragItem.ItemId); item.mTargetIndex = DragItem.mTargetIndex; } else { item.mTargetItemType = DragItem.mItemType; item.SetItemID(DragItem.ItemId); item.mTargetIndex = DragItem.mIndex; } UIBlockSaver.Instance.SetData((mBoxBars.PageIndex - 1) * c_MaxMenuItems + item.mIndex, item); } if (DragItem.mItemType == UIBuildWndItem.ItemType.mMenu && item != DragItem) { DragItem.SetNullContent(); UIBlockSaver.Instance.RemoveData((mBoxBars.PageIndex - 1) * c_MaxMenuItems + DragItem.mIndex); } if (onDropItem != null) { onDropItem(item); } }
void OnDropMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { // if(mMeunControl.DragObejct == null) // return; // //Debug.Log("OnDragMeaterItem:" + mItemType + "," + mIndex); // UIBuildWndItem item = QueryGetDragItem(); // if(item != null) // { // UISprite sp = mMeunControl.DragObejct.GetComponent<UISprite>(); // if(sp != null) // item.GetDrag(mItemType,mIndex, DragItem.mContentSprite.spriteName,DragItem.atlas); // else // item.GetDrag(mItemType,mIndex, DragItem.mContentTexture.mainTexture); // } // GameObject.Destroy(DragObejct); // DragObejct = null; }
void OnItemToolTip(bool show, UIBuildWndItem.ItemType item_type, int item_index) { if (item_type == UIBuildWndItem.ItemType.mVoxelMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item_index]); UITooltip.ShowText(proto.GetName()); } else if (item_type == UIBuildWndItem.ItemType.mBlockMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item_index]); UITooltip.ShowText(proto.GetName()); } else if (item_type == UIBuildWndItem.ItemType.mMenu) { UIBuildWndItem item = mMenuCtrl.mBoxBars.Items[item_index].GetComponent <UIBuildWndItem>(); if (item != null) { if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item.mTargetIndex]); UITooltip.ShowText(proto.GetName()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item.mTargetIndex]); UITooltip.ShowText(proto.GetName()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelType) { int proto_id = BSVoxelMatMap.GetItemID(item.ItemId); ItemProto proto = ItemProto.Mgr.Instance.Get(proto_id); UITooltip.ShowText(proto.GetName()); } } } else if (item_type == UIBuildWndItem.ItemType.mVoxelType) { int proto_id = BSVoxelMatMap.GetItemID(m_VoxelTypeList[item_index]); ItemProto proto = ItemProto.Mgr.Instance.Get(proto_id); UITooltip.ShowText(proto.GetName()); } }
void OnBeginDragMeaterItem(UIBuildWndItem.ItemType mItemType, int mIndex) { //Debug.Log("OnBeginDragMeaterItem:" + mItemType + "," + mIndex); GameObject content = null; if (mItemType == UIBuildWndItem.ItemType.mBlockMat) { if (mIndex >= mBlockMatList.Count && mIndex < 0) { return; } if (mBlockMatList[mIndex].mContentSprite.gameObject.activeSelf) { content = mBlockMatList[mIndex].mContentSprite.gameObject; } else { content = mBlockMatList[mIndex].mContentTexture.gameObject; } mMeunControl.DragItem = mBlockMatList[mIndex]; } else if (mItemType == UIBuildWndItem.ItemType.mBlockPattern) { if (mIndex >= mBlockPatternList.Count && mIndex < 0) { return; } if (mBlockPatternList[mIndex].mContentSprite.gameObject.activeSelf) { content = mBlockPatternList[mIndex].mContentSprite.gameObject; } else { content = mBlockPatternList[mIndex].mContentTexture.gameObject; } mMeunControl.DragItem = mBlockPatternList[mIndex]; } else if (mItemType == UIBuildWndItem.ItemType.mVoxelMat) { if (mIndex >= mVoxelMatList.Count && mIndex < 0) { return; } if (mVoxelMatList[mIndex].mContentSprite.gameObject.activeSelf) { content = mVoxelMatList[mIndex].mContentSprite.gameObject; } else { content = mVoxelMatList[mIndex].mContentTexture.gameObject; } mMeunControl.DragItem = mVoxelMatList[mIndex]; } else if (mItemType == UIBuildWndItem.ItemType.mVoxelType) { if (mIndex >= mTypeList.Count && mIndex < 0) { return; } if (mTypeList[mIndex].mContentSprite.gameObject.activeSelf) { content = mTypeList[mIndex].mContentSprite.gameObject; } else { content = mTypeList[mIndex].mContentTexture.gameObject; } mMeunControl.DragItem = mTypeList[mIndex]; } if (content != null) { if (mMeunControl.DragObejct != null) { Destroy(mMeunControl.DragObejct); mMeunControl.DragObejct = null; } mMeunControl.DragObejct = GameObject.Instantiate(content) as GameObject; mMeunControl.DragObejct.transform.parent = mDragItemContent.transform; mMeunControl.DragObejct.transform.localScale = new Vector3(48, 48, 1); mMeunControl.DragObejct.transform.localPosition = Vector3.zero; Vector3 pos = Input.mousePosition; pos.z = mMeunControl.DragObejct.transform.position.z; mMeunControl.DragObejct.transform.position = pos; } }
public void WndItemOnClick(UIBuildWndItem.ItemType _itemType, int _index) { if (_itemType == UIBuildWndItem.ItemType.mBlockMat) { if (mBlockMatList[_index].IsActive) { if (mBlockMatListSelectIndex > -1) { mBlockMatList[mBlockMatListSelectIndex].SetSelect(false); } mBlockMatListSelectIndex = _index; mBlockMatList[mBlockMatListSelectIndex].SetSelect(true); if (BlockItemOnClick != null) { BlockItemOnClick(_index); } } } else if (_itemType == UIBuildWndItem.ItemType.mBlockPattern) { if (mBlockPatternList[_index].IsActive) { if (mBlockPatternListSelectIndex > -1) { mBlockPatternList[mBlockPatternListSelectIndex].SetSelect(false); } mBlockPatternListSelectIndex = _index; mBlockPatternList[mBlockPatternListSelectIndex].SetSelect(true); if (BlockPatternOnClick != null) { BlockPatternOnClick(_index); } } } else if (_itemType == UIBuildWndItem.ItemType.mVoxelMat) { if (mVoxelMatList[_index].IsActive) { if (mVoxelMatListSelectIndex > -1) { mVoxelMatList[mVoxelMatListSelectIndex].SetSelect(false); } mVoxelMatListSelectIndex = _index; mVoxelMatList[mVoxelMatListSelectIndex].SetSelect(true); if (TextureItemOnClick != null) { TextureItemOnClick(_index); } } } else if (_itemType == UIBuildWndItem.ItemType.mIso) { if (mIsoList[_index].IsActive) { if (mIsoListSelectIndex > -1) { mIsoList[mIsoListSelectIndex].SetSelect(false); } mIsoListSelectIndex = _index; mIsoList[mIsoListSelectIndex].SetSelect(true); if (IsoItemOnClick != null) { IsoItemOnClick(_index); } } } else if (_itemType == UIBuildWndItem.ItemType.mVoxelType) { if (mTypeList[_index].IsActive) { if (mTypeSelectIndex > -1 && mTypeSelectIndex < mTypeList.Count) { mTypeList[mTypeSelectIndex].SetSelect(false); } mTypeSelectIndex = _index; mTypeList[mTypeSelectIndex].SetSelect(true); if (VoxelTypeOnClick != null) { VoxelTypeOnClick(_index); } } } //Debug.Log (_itemType + "," + _index); }