public void SetReciveItem( int iItemID, string strPreItemID, bool isShowTooltip) { if( null != textRandLevel ) textRandLevel.Text = string.Empty; if( 0 == iItemID) { itemName.Text = string.Empty; Item _item = ItemMgr.ItemManagement.GetItem( AsHudDlgMgr.Instance.productionItemId ); if( null != _item ) { itemName.Text = AsTableManager.Instance.GetTbl_String(_item.ItemData.nameId); } return; } m_Item = ItemMgr.ItemManagement.GetItem( iItemID); if ( null == m_Item) return; if( null != m_SlotItem) { GameObject.Destroy( m_SlotItem.gameObject); } m_isShowTooltip = isShowTooltip; m_SlotItem = ResourceLoad.CreateItemIcon( m_Item.GetIcon(), itemImgPos, Vector3.back, minusItemSize, false); if( null != strPreItemID && 0 < strPreItemID.Length) itemName.Text = strPreItemID; else itemName.Text = AsTableManager.Instance.GetTbl_String( m_Item.ItemData.nameId); }
void OnSlotSelected(bool isSelect, GameObject obj) { UISlotItem item = obj.GetComponent <UISlotItem>(); UISlotItemInfo bubble = objSlotBubble.GetComponent <UISlotItemInfo> (); bubble.txtItemName.text = item.item.Name; if (item.item.Category == ItemType.Equipment) { bubble.txtScore.text = item.item.Power.ToString(); bubble.imgItemType.sprite = null; bubble.txtScore.gameObject.SetActive(true); bubble.imgScore.gameObject.SetActive(true); bubble.imgItemType.gameObject.SetActive(true); } else { bubble.txtScore.gameObject.SetActive(false); bubble.imgScore.gameObject.SetActive(false); bubble.imgItemType.gameObject.SetActive(false); } bubble.txtItemInfo.text = item.item.Info; Debug.Log("ItemId = " + item.item.ID + " , ItemName = " + item.item.Name + "ItemCategory = " + item.item.Category); objSlotBubble.SetActive(isSelect); }
//! 生成内部道具 void GenerateItemsInBag() { // 疑问:这个是排序吗? GameData.lstBagItems.Sort((Item x, Item y) => x.Order.CompareTo(y.Order)); for (int i = 0; i < trsSlotItemRoot.childCount; i++) { UISlotItem item = trsSlotItemRoot.GetChild(i).GetComponent <UISlotItem>(); UISelectableItem sItem = item.gameObject.AddMissingComponent <UISelectableItem>(); if (i < GameData.lstBagItems.Count) { item.UpdateShowInfo(GameData.lstBagItems[i]); sItem.bSelectable = true; sItem.cbSelect = OnSlotSelected; } else { item.imgIcon.sprite = null; item.ShowIcon = sItem.bSelectable = false; item.ShowQuality = false; item.ShowScore = false; item.ShowCount = false; sItem.cbSelect = null; } } }
protected void DeleteIcon() { if( null != m_Icon ) { GameObject.DestroyImmediate( m_Icon.gameObject ); m_Icon = null; } }
public void Open( byte _iIndex, ProductionProgData _progData ) { SetSlot(_iIndex); if( null != textShowLevel ) textShowLevel.Text = string.Empty; Tbl_Production_Record record = AsTableManager.Instance.GetProductionTable().GetRecord( _progData.getServerData.nRecipeIndex ); if( null == record ) { Debug.LogError("ProductionProgItemIng::Open()[ recipe index : " + _progData.getServerData.nRecipeIndex ); return; } m_item = ItemMgr.ItemManagement.GetItem( record.getItemID ); if( null == m_item ) { Debug.LogError("ProductionProgItemIng::Open()[ item index : " + record.getItemID ); return; } textItemName.Text = AsTableManager.Instance.GetTbl_String( m_item.ItemData.nameId ); if( null != m_SlotItem ) { GameObject.DestroyObject( m_SlotItem.gameObject ); } if( false == record.IsRandItemType() ) { m_SlotItem = ResourceLoad.CreateItemIcon( m_item.GetIcon(), iconImgPos, Vector3.back, minusItemSize ); GameObject.DestroyImmediate( m_SlotItem.coolTime.gameObject); GameObject.DestroyImmediate( m_SlotItem.itemCountText.gameObject); m_SlotItem.iconImg.renderer.enabled = false; UIListItem _listitem = gameObject.GetComponent<UIListItem>(); if( null != m_SlotItem && null != _listitem ) { _listitem.layers[0] = m_SlotItem.iconImg; } } else { if( null != textShowLevel ) textShowLevel.Text = string.Format( AsTableManager.Instance.GetTbl_String(901), m_item.ItemData.levelLimit ); } m_ProgData = _progData; m_cashSphere = GetCashCost(); textCashCost.Text = m_cashSphere.ToString(); }
protected void CreateIcon(string tex) { GameObject go = Resources.Load( tex ) as GameObject; if( null == go ) { Debug.LogError("GameObject load failed [ name : " + tex ); return; } DeleteIcon(); m_Icon = ResourceLoad.CreateItemIcon( go, iconParent, Vector3.back, vec2Img, false); m_Icon.slotType = UISlotItem.eSLOT_TYPE.BUFF_ICON; m_Icon.isUseRealItem = false; }
public void Open( Item _item, Tbl_Production_Record _record ) { if( null == _item ) { Debug.LogError("ProductionListItem::Open()[ null == Item ]"); return; } if( null == _record ) { Debug.LogError("ProductionListItem::Open()[ null == Tbl_Production_Record ]"); return; } m_record = _record; m_item = _item; textName.Text = AsTableManager.Instance.GetTbl_String( _item.ItemData.nameId ); if( null != textShowLevel ) textShowLevel.Text = string.Empty; if( null != m_SlotItem ) GameObject.DestroyObject( m_SlotItem.gameObject ); if( false == _record.IsRandItemType() ) { m_SlotItem = ResourceLoad.CreateItemIcon( m_item.GetIcon(), iconImgPos, new Vector3(0f,0f,-0.2f), minusItemSize ); GameObject.DestroyImmediate( m_SlotItem.coolTime.gameObject); GameObject.DestroyImmediate( m_SlotItem.itemCountText.gameObject); m_SlotItem.iconImg.renderer.enabled = false; UIListItem _listitem = gameObject.GetComponent<UIListItem>(); if( null != m_SlotItem && null != _listitem ) { _listitem.layers[0] = m_SlotItem.iconImg; } } else { if( null != textShowLevel ) textShowLevel.Text = string.Format( AsTableManager.Instance.GetTbl_String(901), m_item.ItemData.levelLimit ); } IsCheckReadyMaking(); }
public void SetText() { m_RcRewardItem = ItemMgr.ItemManagement.GetItem( m_ItemIndex ); if( null == m_RcRewardItem ) return; m_RcItemNameText.Text = AsTableManager.Instance.GetTbl_String( m_RcRewardItem.ItemData.nameId); if( null != m_RcRewardSlotItem) GameObject.Destroy( m_RcRewardSlotItem.gameObject); m_RcRewardSlotItem = ResourceLoad.CreateItemIcon( m_RcRewardItem.GetIcon(), m_RcRewarditemImgPos, Vector3.back, minusItemSize, true); m_RcRewarditemImgPos.renderer.enabled = false; //m_RcRewardSlotItem.SetItemCountText(m_ItemCount); //#22119 if(m_ItemCount > 1) m_CountText.Text = m_ItemCount.ToString(); else m_CountText.Text = string.Empty; m_RcMessageText.Text = string.Format( AsTableManager.Instance.GetTbl_String( 1910),m_AccrueCount ); }
public void SetFbRewardData(int index, body_SC_GAME_INVITE_LIST_RESULT data) { m_id = index; m_eGAME_INVITE_PLATFORM = eGAME_INVITE_PLATFORM.eGAME_INVITE_PLATFORM_FACEBOOK; m_RewardItem = ItemMgr.ItemManagement.GetItem( data.nFacebook_Reward_ItemIdx[m_id]); if( null == m_RewardItem) { Debug.Log("SetFbRewardData():: null == m_RewardItem"); return; } m_ItemNameText.Text = AsTableManager.Instance.GetTbl_String( m_RewardItem.ItemData.nameId); if( null != m_RewardSlotItem) GameObject.Destroy( m_RewardSlotItem.gameObject); m_RewardSlotItem = ResourceLoad.CreateItemIcon( m_RewardItem.GetIcon(), m_RewarditemImgPos, Vector3.back, minusItemSize, true); if(data.nFacebook_Reward_ItemCount[m_id] > 1) m_CountText.Text = data.nFacebook_Reward_ItemCount[m_id].ToString(); else m_CountText.Text = string.Empty; m_MessageText.Text = string.Format( AsTableManager.Instance.GetTbl_String( 4063), data.nFacebook_Goal[m_id]); m_MessageText.Color = m_FbMsgColor; m_RewardBtn.gameObject.SetActiveRecursively( true); if( 1 == data.bFacebook_Reward[m_id]) { m_RewardBtn.SetControlState( UIButton.CONTROL_STATE.NORMAL); m_RewardBtn.controlIsEnabled = true; m_RewardBtn.spriteText.Color = Color.black; } else { if( data.nFacebook_Total >= data.nFacebook_Goal[m_id])//#20228. m_RewardBtn.Text = AsTableManager.Instance.GetTbl_String( 1566); m_RewardBtn.SetControlState( UIButton.CONTROL_STATE.DISABLED); m_RewardBtn.controlIsEnabled = false; m_RewardBtn.spriteText.Color = Color.gray; } }
//public void SetMarkType(QuestMarkType _type) //{ // try // { // nowType = _type; // foreach (SimpleSprite sprite in questSprites) // sprite.Hide(true); // if (nowType == QuestMarkType.CLEAR_REMAINTALK || nowType == QuestMarkType.TALK_CLEAR || nowType == QuestMarkType.TALK_HAVE) // questSprites[(int)QuestPanelType.QUEST_NEW_TALK].Hide(false); // else if (nowType == QuestMarkType.CLEAR || nowType == QuestMarkType.CLEAR_AND_HAVE) // questSprites[(int)QuestPanelType.QUEST_CLAR].Hide(false); // else if (nowType == QuestMarkType.HAVE) // questSprites[(int)QuestPanelType.QUEST_NEW].Hide(false); // else if (nowType == QuestMarkType.UPPERLEVEL) // questSprites[(int)QuestPanelType.QUEST_NEW_UPPERLEVEL].Hide(false); // } // catch (System.Exception e) // { // Debug.LogError(e.Message); // } //} public void Initilize(AsBaseEntity _baseEntity, BoxCollider _collider, float _namePanelPosY, AchUseItemToTarget _achUseItemToTarget, UISlotItem _slotItem, CoolTimeGroup _coolTimeGroup) { m_bShowCommand = true; m_baseEntity = _baseEntity; achUseItemToTarget = _achUseItemToTarget; slotItem = _slotItem; coolTimeGroup = _coolTimeGroup; gameObject.SetActiveRecursively(true); if (_baseEntity.questPanel != null) _baseEntity.questPanel.gameObject.SetActiveRecursively(false); if (_baseEntity.collectionMark != null) _baseEntity.collectionMark.Visible = false; itemCollider = _collider; // Calculate U.I Position m_vUIPosRevision.x = 0.0f; m_vUIPosRevision.y = _namePanelPosY;// +questSprites[0].height * 0.5f; m_vUIPosRevision.z = m_fNamePanelLayer; dummyLeadTop = m_baseEntity.GetDummyTransform("DummyLeadTop"); if (null == dummyLeadTop) { if( true == m_baseEntity.isKeepDummyObj) { Vector3 vPos = m_baseEntity.transform.position; vPos.y += m_baseEntity.characterController.height; transform.position = _WorldToUIPoint( vPos, m_vUIPosRevision); } else Debug.LogWarning("DummyLeadTop is not found"); } else transform.position = _WorldToUIPoint(dummyLeadTop.position, m_vUIPosRevision);////////// }
//--------------------------------------------------------------------- /* protected function*/ //--------------------------------------------------------------------- protected void CreateIcon( string tex) { GameObject go = Resources.Load( tex) as GameObject; if( null == go) { Debug.LogError( "GameObject load failed [ name : " + tex); return; } DeleteIcon(); GameObject goIns = GameObject.Instantiate( go) as GameObject; m_Icon = goIns.GetComponentInChildren<UISlotItem>(); m_Icon.transform.parent = transform; m_Icon.transform.localPosition= Vector3.zero; m_Icon.transform.localRotation= Quaternion.identity; m_Icon.transform.localScale= Vector3.one; m_Icon.slotType = UISlotItem.eSLOT_TYPE.BUFF_ICON; m_Icon.isUseRealItem = false; }
public void SetAttendItem(int iItemID , string txtDay , Color _textColor , bool isFinish , bool isSelect , int nCount) { m_Item = ItemMgr.ItemManagement.GetItem( iItemID ); if( m_Item == null ) { Debug.LogError("AttendBonusSlot item is null. item id : " + iItemID.ToString() ); return; } if( m_SlotItem != null ) { GameObject.Destroy( m_SlotItem.gameObject ); } m_SlotItem = ResourceLoad.CreateItemIcon( m_Item.GetIcon() , m_itemImgPos , Vector3.back , m_minusItemSize , false ); m_SlotItem.SetItemCountText( nCount ); m_txtDay.Text = txtDay; SetAttendItemProperty( _textColor , isFinish , isSelect ); }
//! 生成内部道具 public void GenerateItemsInBag(int itemtype) { ItemsClear(); for (int i = 0; i < GameData.lstBagItems.Count; i++) { if (GameData.lstBagItems[i].Type == itemtype) { var obj = GameObject.Instantiate(objSlotItem) as GameObject; obj.name = GameData.lstBagItems[i].ID; obj.transform.SetParent(trsSlotItemRoot); obj.transform.localScale = Vector3.one; UISlotItem item = obj.GetComponent <UISlotItem>(); //UISelectableItem sItem = item.gameObject.AddMissingComponent<UISelectableItem>(); item.UpdateShowInfo(GameData.lstBagItems[i]); //sItem.bSelectable = true; //sItem.cbSelect = OnSlotSelected; } } }
// float fOffsetToolTip = -3.0f; public void Open( sITEM _sitem ) { m_sItem = _sitem; if( null == m_sItem ) { Debug.LogError("AsExpireItem::Open()[ null == sITEM ) "); return; } m_item = ItemMgr.ItemManagement.GetItem( m_sItem.nItemTableIdx ); if( null == m_item ) { Debug.LogError("AsExpireItem::Open()[ null == Item ) id: " + m_sItem.nItemTableIdx ); return; } if( null != textItemName ) textItemName.Text = AsTableManager.Instance.GetTbl_String( m_item.ItemData.nameId ); if( null != m_SlotItem ) { GameObject.DestroyObject( m_SlotItem.gameObject ); } m_SlotItem = ResourceLoad.CreateItemIcon( m_item.GetIcon(), iconImgPos, Vector3.back, minusItemSize, false ); UIListItem _listitem = gameObject.GetComponent<UIListItem>(); if( null != m_SlotItem && null != _listitem ) { m_SlotItem.iconImg.renderer.enabled = false; _listitem.layers[0] = m_SlotItem.iconImg; m_SlotItem.slotType = UISlotItem.eSLOT_TYPE.NO_COOLTIME; } }
public void Open( Tbl_Production_Record _record) { m_record = _record; if( null == _record) { Debug.LogError("ProductionListTab::InsertItem()[ null == Tbl_Production_Record ]"); return; } m_item = ItemMgr.ItemManagement.GetItem( _record.getItemID); if( null == m_item) { Debug.LogError("ProductionListTab::InsertItem()[ null == item ] id : " + _record.getItemID); return; } if( null != m_SlotItem) GameObject.DestroyObject( m_SlotItem.gameObject); if( 1 < m_record.getItemCount) textMakingCount.Text = m_record.getItemCount.ToString(); else textMakingCount.Text = string.Empty; textItemName.Text = AsTableManager.Instance.GetTbl_String( m_item.ItemData.nameId); textNeedTime.Text = AsMath.GetDateConvertRemainTime( (int)_record.itemTime, AsTableManager.Instance.GetTbl_String(88), AsTableManager.Instance.GetTbl_String(89), AsTableManager.Instance.GetTbl_String(90)); textMakeExp.Text = _record.iExpertism.ToString(); textExp.Text = _record.iExp.ToString(); textMakingCost.Text = _record.iGold.ToString( "#,#0", CultureInfo.InvariantCulture); m_sbMatsTemp.Length = 0; m_sbMatsTemp.Append( "Lv."); m_sbMatsTemp.Append( m_item.ItemData.levelLimit); textLevel.Text = m_sbMatsTemp.ToString(); textGrade.Text = m_item.GetStrGrade(); textOptionShow.Text = string.Empty; if( null!= textRandomPrint) textRandomPrint.Text = string.Empty; if( null != textShowLevel ) textShowLevel.Text = string.Empty; textOption.Text = string.Empty; textOption_1.Text = string.Empty; m_isRandomItem = _record.IsRandItemType(); if( false == m_isRandomItem ) { m_SlotItem = ResourceLoad.CreateItemIcon( m_item.GetIcon(), iconImgPos, Vector3.back, minusItemSize, false); textOption_1.Text = string.Empty; int iMin = 0; int iMax = 0; m_sbMatsTemp.Length= 0; if( Item.eITEM_TYPE.EquipItem == m_item.ItemData.GetItemType() || Item.eITEM_TYPE.CosEquipItem == m_item.ItemData.GetItemType()) { switch( (Item.eEQUIP) m_item.ItemData.GetSubType()) { case Item.eEQUIP.Weapon: if( m_item.ItemData.needClass == eCLASS.CLERIC || m_item.ItemData.needClass == eCLASS.MAGICIAN) { iMin = m_item.ItemData.matkDmgMin; iMax = m_item.ItemData.matkDmgMax; m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1059)); } else { iMin = m_item.ItemData.parkDmgMin; iMax = m_item.ItemData.parkDmgMax; m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1051)); } m_sbMatsTemp.Append( iMin); m_sbMatsTemp.Append( "~"); m_sbMatsTemp.Append( iMax); textOption.Text = m_sbMatsTemp.ToString(); break; case Item.eEQUIP.Ring: case Item.eEQUIP.Earring: case Item.eEQUIP.Necklace: textOption.Text = m_sbMatsTemp.ToString(); break; default: m_sbMatsTemp.Length = 0; m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1052)); m_sbMatsTemp.Append( m_item.ItemData.pDef); textOption.Text = m_sbMatsTemp.ToString(); m_sbMatsTemp.Length = 0; m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1053)); m_sbMatsTemp.Append( m_item.ItemData.mDef); textOption_1.Text = m_sbMatsTemp.ToString(); break; } m_sbMatsTemp.Length = 0; m_sbMatsTemp.Append( Color.red); m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1001)); textOptionShow.Text = m_sbMatsTemp.ToString(); } else if( Item.eITEM_TYPE.ActionItem == m_item.ItemData.GetItemType()) { Tbl_Skill_Record record = AsTableManager.Instance.GetTbl_Skill_Record( m_item.ItemData.itemSkill); if( null == record) { Debug.LogError("TooltipInfoDlg::SetConsumeItem() [ null == record ] skill level id : " + m_item.ItemData.itemSkill); return; } string szDesc = AsTableManager.Instance.GetTbl_String( record.Description_Index); szDesc = AsUtil.ModifyDescriptionInTooltip( szDesc, m_item.ItemData.itemSkill, m_item.ItemData.itemSkillLevel, 0); textOption.Text = szDesc; } else { m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String( m_item.ItemData.destId)); textOption.Text = m_sbMatsTemp.ToString(); } } else { string levelTemp = string.Format( AsTableManager.Instance.GetTbl_String(901), m_item.ItemData.levelLimit ); if( null != textShowLevel ) textShowLevel.Text = levelTemp; textLevel.Text = levelTemp; textGrade.Text = string.Empty; m_sbMatsTemp.Length = 0; m_sbMatsTemp.Append( Color.red); m_sbMatsTemp.Append( AsTableManager.Instance.GetTbl_String(1001)); //textOptionShow.Text = m_sbMatsTemp.ToString(); if( null!= textRandomPrint) textRandomPrint.Text = m_sbMatsTemp.ToString(); } for( int i = 0; i < 4; ++i) { if( null != m_MatSlotItems[i]) GameObject.DestroyObject( m_MatSlotItems[i].gameObject); int iItemId = 0; switch( i) { case 0: iItemId = _record.iBaseID; break; case 1: iItemId = _record.iSubID_1; break; case 2: iItemId = _record.iSubID_2; break; case 3: iItemId = _record.iOpID; break; } if( int.MaxValue == iItemId) continue; Item _matItem = ItemMgr.ItemManagement.GetItem( iItemId); if( null == _matItem) { Debug.LogError("ProductionPlanTab::Open()[ no find item ] id: " + iItemId); continue; } m_itemList[i] = _matItem; m_MatSlotItems[i] = ResourceLoad.CreateItemIcon( _matItem.GetIcon(), iconImgPosMats[i], Vector3.back, minusItemSize, false); } IsCheckReadyMaking(); if( AsHudDlgMgr.Instance.IsOpenPlayerStatus) AsHudDlgMgr.Instance.ClosePlayerStatus(); }
//input public void GuiInputDown( Ray inputRay) { m_DownSlotItem = null; if( ( null != m_SlotItem) && ( true == AsUtil.PtInCollider( iconImgPos.collider, inputRay))) { m_DownSlotItem = m_SlotItem; return; } for( int i = 0; i < 4; ++i) { if( ( null != m_MatSlotItems[i]) && ( true == AsUtil.PtInCollider( iconImgPosMats[i].collider, inputRay))) { m_DownSlotItem = m_MatSlotItems[i]; return; } } }
public void SetSlotItem( UISlotItem _slotItem) { m_SlotItem = _slotItem; }
// IEnumerator RefreshFilledProcess() // { // while( true) // { // yield return null; // // if( m_LockedSlot != null && m_SlotItem != null) // { // if( m_LockedSlot != null) m_LockedSlot.gameObject.SetActiveRecursively( false); // if( m_SlotItem != null) // { // m_SlotItem.gameObject.SetActiveRecursively( true); // m_SlotItem.ShowCoolTime( false); // } // // break; // } // } // } public void SetMovingSlot( UIPStoreSlot _slot) { m_SlotItem = _slot.slotItem; m_Idx = _slot.slotIndex; m_InvenIdx = _slot.InvenIdx; m_TextName = _slot.TextName; m_Gold = _slot.gold; }
public void Clear() { m_State = eState.Blank; if( null != m_SlotItem) { DestroyImmediate( m_SlotItem.gameObject); m_SlotItem = null; listContatiner.ScanChildren(); } if( textName != null && textGold != null) { textName.Text = ""; m_TextName = ""; textGold.Text = ""; } if( m_LockedSlot != null) m_LockedSlot.gameObject.SetActiveRecursively( false); if( spriteCoin != null) spriteCoin.gameObject.SetActiveRecursively( true); if( spriteBg != null) spriteBg.renderer.material.SetColor( "_Color", Color.white); }
bool _CreateSlotItem( sITEM _item, int _idx, ulong _gold, Transform _trnParent) { m_State = eState.Filled; RealItem realItem = new RealItem( _item, _idx); GameObject resGo = realItem.item.GetIcon(); if( null == resGo) { Debug.LogError( "UIPStoreSlot::CreateSlotItem() [ null == resGo ] item id : " + realItem.item.ItemID); return false; } //-- instantiate image GameObject go = GameObject.Instantiate( resGo) as GameObject; // go.transform.parent = _trnParent; go.transform.parent = IconSlot; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; UISlotItem __slotItem = go.GetComponent<UISlotItem>(); if( null == __slotItem) { Debug.LogError( "UIPStoreSlot::CreateSlotItem() [ null == slotItem"); Destroy( go); return false; } //-- set on top scroll pos UIScrollList list = listContatiner.GetScrollList(); // float curPos = m_Idx - 4; if( curPos < 0) curPos = 0; // list.ScrollListTo( curPos / 7f);//( ( float)AsHudDlgMgr.Instance.pstoreDlg.slotCount - 1f)); float listHeight = list.viewableArea.y; Debug.LogWarning( "listContatiner.ClippingRect.height = " + listContatiner.ClippingRect.height); float unit_Y = 3.2f; float total = AsHudDlgMgr.Instance.pstoreDlg.slotCount; float length = ( ( unit_Y * total) + ( 0.01f * ( total - 1)) - listHeight); if( m_Idx > 4) { // float rest = listHeight - unit_Y * 5; // float rest = listHeight % ( unit_Y + 0.02f); float rest = 0.103f * length; float curPos = ( ( ( m_Idx - 5) * unit_Y)/* + ( ( m_Idx - 5) * 0.01f)*/ + rest) / length; if( curPos > 1) curPos = 1; list.ScrollListTo( curPos); } //-- set slot item info __slotItem.SetItem( realItem); m_SlotItem = __slotItem; m_SlotItem.ShowCoolTime( false); ResetSlotItemPosition(); // Vector3 vColliderSize = m_IconSlot.collider.bounds.size; // m_SlotItem.iconImg.SetSize( vColliderSize.x, vColliderSize.y); float width = m_IconSlot.GetComponent<SimpleSprite>().width; float height = m_IconSlot.GetComponent<SimpleSprite>().height; m_SlotItem.iconImg.SetSize( width, height); m_InvenIdx = _idx; if( textName != null && textGold != null) { string str = m_SlotItem.realItem.item.ItemData.GetGradeColor() + AsTableManager.Instance.GetTbl_String( realItem.item.ItemData.nameId); if( m_SlotItem.realItem.sItem.nStrengthenCount > 0) str = colorStrength + "+" + m_SlotItem.realItem.sItem.nStrengthenCount + " " + str; textName.Text = str; m_TextName = str; textGold.Text = _gold.ToString( "#,#0", CultureInfo.InvariantCulture); m_Gold = _gold; } //-- scan child listContatiner.ScanChildren(); listContatiner.GetScrollList().ClipItems(); return true; }
bool _SetSlotImg( GameObject _img) { if( m_Object != null) Destroy( m_Object); m_Object = GameObject.Instantiate( _img ) as GameObject; m_Object.transform.parent = transform; m_Object.transform.localPosition = new Vector3( 0, 0, -0.2f); m_Object.transform.localRotation = Quaternion.identity; m_Object.transform.localScale = Vector3.one; m_SlotItem = m_Object.GetComponent<UISlotItem>(); float width = 1f; float height = 1f; BoxCollider boxCollider = collider as BoxCollider; if(boxCollider != null) { width = boxCollider.size.x; height = boxCollider.size.y; } else { width = transform.localScale.x; height = transform.localScale.y; } m_SlotItem.iconImg.SetSize( width, height); return true; }
public void SetRewardItem() { if (data.isRewardReceived == true) { spriteRewardBase.gameObject.SetActive(true); spriteRewardDone.gameObject.SetActive(true); if( rewardSlotItem != null ) Destroy( rewardSlotItem.gameObject ); return; } // designation reward int nItemId = -1; int nItemCount = 0; eCLASS _class = AsEntityManager.Instance.UserEntity.GetProperty<eCLASS> (eComponentProperty.CLASS); switch (_class) { case eCLASS.DIVINEKNIGHT: nItemId = data.DivineKnight_Item_ID; nItemCount = data.DivineKnight_Item_Count; break; case eCLASS.MAGICIAN: nItemId = data.Magician_Item_ID; nItemCount = data.Magician_Item_Count; break; case eCLASS.CLERIC: nItemId = data.Cleric_Item_ID; nItemCount = data.Cleric_Item_Count; break; case eCLASS.HUNTER: nItemId = data.Hunter_Item_ID; nItemCount = data.Hunter_Item_Count; break; } if (nItemId <= 0) { spriteRewardBase.gameObject.SetActive(true); spriteRewardDone.gameObject.SetActive(false); return; } spriteRewardBase.gameObject.SetActive(true); spriteRewardDone.gameObject.SetActive(false); Item _item = ItemMgr.ItemManagement.GetItem(nItemId); if (null == _item) { Debug.LogError("AsDesignationItem::Open()[ null == item ] id: " + nItemId); return; } if( rewardSlotItem != null ) Destroy( rewardSlotItem.gameObject ); rewardSlotItem = ResourceLoad.CreateItemIcon(_item.GetIcon(), spriteRewardBase, Vector3.back, minusItemSize, false); if (null == rewardSlotItem) { Debug.LogError("AsDesignationItem::Open()[ null == UISlotItem ] id: " + nItemId); return; } /* if (nItemCount > 1) rewardSlotItem.itemCountText.Text = nItemCount.ToString (); else rewardSlotItem.itemCountText.Text = string.Empty; */ // designatio item don't display item count. rewardSlotItem.itemCountText.Text = string.Empty; Vector2 vItemSize = new Vector2( spriteRewardBase.gameObject.GetComponent<BoxCollider>().size.x, spriteRewardBase.gameObject.GetComponent<BoxCollider>().size.y); UIButton button = rewardSlotItem.gameObject.AddComponent<UIButton>(); button.width = vItemSize.x; button.height = vItemSize.y; button.SetInputDelegate( RewardItemClick ); }
public void SetSelfItem(int iItemTableIndex, SimpleSprite parentSprite) { Item _item = ItemMgr.ItemManagement.GetItem(iItemTableIndex); if (null == _item) { Debug.LogError("AsUIRandItem::Open()[ null == item ] id: " + iItemTableIndex); return; } UISlotItem _SlotItem = ResourceLoad.CreateItemIcon(_item.GetIcon(), parentSprite, Vector3.back, minusItemSize, false); if (null == _SlotItem) { Debug.LogError("AsUIRandItem::Open()[ null == UISlotItem ] id: " + iItemTableIndex); return; } _SlotItem.tempItem = _item; m_SelfSlotItem = _SlotItem; m_SelfSlotItem.gameObject.SetActive(false); }
public void SetItem() { m_Item = ItemMgr.ItemManagement.GetItem( AsEventUIMgr.Instance.RecommendItemTableIdx); if( null == m_Item) return; m_RewardItemName.Text = AsTableManager.Instance.GetTbl_String( m_Item.ItemData.nameId); if( null != m_SlotItem) GameObject.Destroy( m_SlotItem.gameObject); m_SlotItem = ResourceLoad.CreateItemIcon( m_Item.GetIcon(), itemImgPos, Vector3.back, minusItemSize); }
//input public override void GuiInputDown( Ray inputRay) { m_DownSlotItem = null; // if( null != m_SlotItem && true == iconImgPos.collider.bounds.IntersectRay( inputRay ) ) if( ( null != m_SlotItem) && ( true == AsUtil.PtInCollider( m_SlotItem.iconImg.collider, inputRay))) { m_DownSlotItem = m_SlotItem; } }
public void SetData( int itemId, GameObject go, bool isIconCollider = true ) { Item item = ItemMgr.ItemManagement.GetItem( itemId); if( null == item) return; float fTextWidth = m_ItemNameText.GetWidth( AsTableManager.Instance.GetTbl_String( item.ItemData.nameId)); ChangePanelSize( fTextWidth); StringBuilder sbItemName = new StringBuilder(); sbItemName.Insert( 0, item.ItemData.GetGradeColor().ToString()); sbItemName.AppendFormat( "{0}", AsTableManager.Instance.GetTbl_String( item.ItemData.nameId)); m_ItemNameText.Text = sbItemName.ToString(); if( null != m_SlotItem) GameObject.Destroy( m_SlotItem.gameObject); m_SlotItem = ResourceLoad.CreateItemIcon( item.GetIcon(), itemImgPos, Vector3.back, minusItemSize, isIconCollider ); m_ParentObj = go; Debug.Log( "SetData" + transform.position); m_bShowCommand = false; gameObject.SetActiveRecursively( m_bShowCommand); }
public void Open( UIInvenSlot _invenSlot, int _pstoreSlot, OkBtnClickDelegate _delOk, CancelBtnClickDelegate _delCancel) { gameObject.SetActiveRecursively( true); invenSlot = _invenSlot; invenSlotIdx = _invenSlot.slotIndex; pstoreSlot = _pstoreSlot; itemCount = _invenSlot.slotItem.realItem.sItem.nOverlapped; itemMax = _invenSlot.slotItem.realItem.sItem.nOverlapped; string str = _invenSlot.slotItem.realItem.item.ItemData.GetGradeColor() + AsTableManager.Instance.GetTbl_String(_invenSlot.slotItem.realItem.item.ItemData.nameId); if( _invenSlot.slotItem.realItem.sItem.nStrengthenCount > 0) str = colorStrength + "+" + _invenSlot.slotItem.realItem.sItem.nStrengthenCount + " " + str; textItemName.Text = str; textFieldGold.Text = ""; textGold.Text = ""; textCount.Text = _invenSlot.slotItem.realItem.sItem.nOverlapped.ToString(); DeactivateOkBtn(); GameObject resGo = _invenSlot.slotItem.realItem.item.GetIcon(); if( null == resGo) Debug.LogError( "UIPStoreGoodsBox::Open() [ null == resGo ] item id : " + _invenSlot.slotItem.realItem.item.ItemID); GameObject go = GameObject.Instantiate( resGo) as GameObject; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; m_SlotItem = go.GetComponent<UISlotItem>(); if( null == m_SlotItem) { Debug.LogError( "UIPStoreGoodsBox::Open() [ null == slotItem"); Destroy( go); } m_SlotItem.SetItem( _invenSlot.slotItem.realItem); m_SlotItem.iconImg.SetSize( iconSlot.collider.bounds.size.x, iconSlot.collider.bounds.size.y); Vector3 pos = iconSlot.position; pos.z -= 0.5f; m_SlotItem.transform.position = pos; m_delOk = _delOk; m_delCancel = _delCancel; //fixed m_DefaultPrice = AsTableManager.Instance.GetTbl_String(1705); textFieldGold.maxLength = 0; textFieldGold.Text = m_DefaultPrice; // sell amount limit m_ulCurSellAmountLimit = GetMaxPStoreSellAmount( _invenSlot.slotItem.realItem); textSellAmountLimit_Gold.Text = m_ulCurSellAmountLimit.ToString( "#,#0", CultureInfo.InvariantCulture); }
public bool CreateSlotItem( Item _item, Transform trmParent ) { if( null == _item ) { Debug.LogError("EnchantSlot::CreateSlotItem() [ null == realItem ]"); return false; } GameObject resGo = _item.GetIcon(); if( null == resGo ) { Debug.LogError("EnchantSlot::CreateSlotItem() [ null == resGo ] item id : " + _item.ItemID ); return false; } DeleteSlotItem(); m_Object = GameObject.Instantiate( resGo ) as GameObject; m_Object.transform.parent = trmParent; m_Object.transform.localPosition = Vector3.zero; m_Object.transform.localRotation = Quaternion.identity; m_Object.transform.localScale = Vector3.one; m_uiSlotItem = m_Object.GetComponent<UISlotItem>(); SetItem( _item ); ResetSlotItemPosition(); return true; }
public void SetSlotItem( UISlotItem slotItem ) { m_slotItem = slotItem; }