public void Open( int iCount, sPRODUCT_INFO[] _dataList) { if( null == _dataList) { Debug.LogError( "ProductionTechnologyTab::Open() [ null == body1_SC_ITEM_PRODUCT_INFO ]"); return; } techList.ClearList( true); for( int i = 0; i < (int)eITEM_PRODUCT_TECHNIQUE_TYPE.eITEM_PRODUCT_TECHNIQUE_MAX; ++i) { if( 0 == iCount) { InsertItemDef( (eITEM_PRODUCT_TECHNIQUE_TYPE)i, null); } else { if( _dataList.Length <= i) { Debug.LogError( "ProductionTechnologyTab::Open()[ sProductInfo.Length <= i ] sPRODUCT_INFO Count : " + iCount + " sProductInfo.Length : " + _dataList.Length); continue; } if( 1 <= _dataList[i].nLevel) InsertItemOpen( (eITEM_PRODUCT_TECHNIQUE_TYPE)i, _dataList[i]); else InsertItemCash( (eITEM_PRODUCT_TECHNIQUE_TYPE)i, null); } } techList.ScrollToItem( 0, 0.0f); }
public virtual void Open( eITEM_PRODUCT_TECHNIQUE_TYPE _eType, sPRODUCT_INFO _info ) { m_info = _info; m_eType = _eType; //string strText = GetName(m_eType) + " "; if( null != _info ) { //strText += _info.nLevel; SetTechName( string.Format( "{0} {1:0}", GetName(m_eType), _info.nLevel ) ); } else { //strText = GetName(m_eType); SetTechName( GetName(m_eType) ); } if( null != btnListView ) btnListView.SetInputDelegate(ListViewBtnDelegate); }
public override void Open( eITEM_PRODUCT_TECHNIQUE_TYPE _eType, sPRODUCT_INFO _info ) { if( null == _info ) { Debug.LogError("ProductionTechItemOpen::Open()[ null == sPRODUCT_INFO ]"); return; } base.Open( _eType, _info ); Tbl_Technic_Record record = AsTableManager.Instance.GetTechnicTable().GetRecord( getProductTechType, _info.nLevel ); if( null == record ) { Debug.LogError("ProductionTechItemOpen::Open()[ null == Tbl_Technic_Record ] type : " + getProductTechType + " level : " + _info.nLevel ); return; } int iCurExp = _info.nTotExp - record.getExp; int iCurMaxExp = record.getExp; m_SphereCost = 0; Tbl_Technic_Record nextLevelRecord = AsTableManager.Instance.GetTechnicTable().GetRecord( getProductTechType, _info.nLevel+1 ); if( null != nextLevelRecord ) { iCurMaxExp = nextLevelRecord.getExp - iCurMaxExp; if( nextLevelRecord.getMiracle == 0 ) { Debug.LogError("ProductionTechItemOpen::Open()[nextLevelRecord.getMiracle == 0]"); return; } int iTotalExp = _info.nTotExp; int iInfoExp = nextLevelRecord.getExp; m_SphereCost = (iInfoExp - iTotalExp) / nextLevelRecord.getMiracle + ((iInfoExp - iTotalExp)% nextLevelRecord.getMiracle == 0 ? 0 : 1 ); } else { Tbl_Technic_Record preLevelRecord = AsTableManager.Instance.GetTechnicTable().GetRecord( getProductTechType, _info.nLevel-1 ); if( null != preLevelRecord ) { iCurMaxExp = iCurMaxExp - preLevelRecord.getExp; iCurExp = _info.nTotExp - preLevelRecord.getExp; } } textCashCost.Text = m_SphereCost.ToString(); //textExpShow.Text = AsTableManager.Instance.GetTbl_String( 1014 ) + " " + iCurExp.ToString() + "/" + iCurMaxExp.ToString(); m_sbExpShow.Append( AsTableManager.Instance.GetTbl_String( 1014 ) ); m_sbExpShow.Append(" "); m_sbExpShow.Append(iCurExp); m_sbExpShow.Append("/"); m_sbExpShow.Append(iCurMaxExp); textExpShow.Text =m_sbExpShow.ToString(); if( 0 != iCurMaxExp ) gaugeBar.Value = (float)iCurExp / (float)iCurMaxExp; int iMaxLevel = AsTableManager.Instance.GetTechnicTable().GetMaxLevel( (int)_eType ); if( iMaxLevel <= _info.nLevel ) { btnCashUp.controlIsEnabled = false; btnCashLevelUp.controlIsEnabled = false; } }
public override void Open( eITEM_PRODUCT_TECHNIQUE_TYPE _eType, sPRODUCT_INFO _info) { base.Open( _eType, _info); SetTechName( GetName(_eType)); }
public void InsertItemCash( eITEM_PRODUCT_TECHNIQUE_TYPE eType, sPRODUCT_INFO _info) { UIListItem item = techList.CreateItem( goResTechnologyItemCash) as UIListItem; ProductionTechItemCash _techItem = item.gameObject.GetComponent<ProductionTechItemCash>(); _techItem.Open( eType, _info); }
public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // bConnect byte[] connect = new byte[ sizeof( bool)]; Buffer.BlockCopy( data, index, connect, 0, sizeof( bool)); headerinfo = infotype.GetField( "bProgress", BINDING_FLAGS_PIG); headerinfo.SetValue( this, BitConverter.ToBoolean( connect, 0)); index += sizeof( bool); int iProductInfoCount = (int)eITEM_PRODUCT_TECHNIQUE_TYPE.eITEM_PRODUCT_TECHNIQUE_MAX; sProductInfo = new sPRODUCT_INFO[ iProductInfoCount ]; for( int i = 0; i < iProductInfoCount; i++) { sProductInfo[i] = new sPRODUCT_INFO(); byte[] tmpData = new byte[sPRODUCT_INFO.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); sProductInfo[i].ByteArrayToClass( tmpData); index += sPRODUCT_INFO.size; } headerinfo = infotype.GetField( "nBody2Cnt", BINDING_FLAGS_PIG); headerinfo.SetValue( this, data[index++]); if( 0 >= nBody2Cnt) return; body = new body2_SC_ITEM_PRODUCT_INFO[ nBody2Cnt ]; for( int i = 0; i < nBody2Cnt; i++) { body[i] = new body2_SC_ITEM_PRODUCT_INFO(); byte[] tmpData = new byte[ body2_SC_ITEM_PRODUCT_INFO.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); body[i].ByteArrayToClass( tmpData); index += body2_SC_ITEM_PRODUCT_INFO.size; } }