public void SetInfo( body2_SC_POST_LIST_RESULT info, string strTitle = "") { this.info = info; if( strTitle.Length > 0) title.Text = strTitle; period.Text = ( info.nDeleteTime / ( 3600 * 24)).ToString() + AsTableManager.Instance.GetTbl_String(91); bool showHasItem = ( 0 != info.sRecievItem1.nOverlapped) || ( 0 != info.sRecievItem2.nOverlapped) || ( 0 != info.sRecievItem3.nOverlapped) || ( 0 != info.sRecievItem4.nOverlapped); hasItem.gameObject.SetActiveRecursively( showHasItem); isReaded.gameObject.SetActiveRecursively( !info.bRead); }
public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // eResult byte[] result = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "eResult", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, result, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( result, 0)); index += sizeof( Int32); // nPostCount headerinfo = infotype.GetField( "nPostCount", BINDING_FLAGS_PIG); headerinfo.SetValue( this, data[ index++]); body = new body2_SC_POST_LIST_RESULT[ nPostCount]; for( int i = 0; i < nPostCount; i++) { body[i] = new body2_SC_POST_LIST_RESULT(); index = body[i].PacketBytesToClass( data, index); } }
public void SetMailDetailInfo( body2_SC_POST_LIST_RESULT info) { if( ePOSTTYPE.ePOSTTYPE_NOTHING == (ePOSTTYPE)(info.nPostType)) { btnReply.SetControlState( UIButton.CONTROL_STATE.NORMAL); btnReply.spriteText.Color = Color.black; } else { btnReply.SetControlState( UIButton.CONTROL_STATE.DISABLED); btnReply.spriteText.Color = Color.gray; } recvFrom.Text = _GetPostSenderName( info); recvTitle.Text = _GetPostTitle( info, false); recvGold.Text = info.nGold.ToString( "#,#0", CultureInfo.InvariantCulture); if( scrollListReadContent.Count > 0) scrollListReadContent.RemoveItem( 0, true); scrollListReadContent.CreateItem( listItemReadContent, _GetPostContent( info)); if( 0 != info.sRecievItem1.nOverlapped) recvItemSlots[0].SetItem( info.sRecievItem1.nItemTableIdx, info.sRecievItem1.nOverlapped, info.sRecievItem1); if( 0 != info.sRecievItem2.nOverlapped) recvItemSlots[1].SetItem( info.sRecievItem2.nItemTableIdx, info.sRecievItem2.nOverlapped, info.sRecievItem2); if( 0 != info.sRecievItem3.nOverlapped) recvItemSlots[2].SetItem( info.sRecievItem3.nItemTableIdx, info.sRecievItem3.nOverlapped, info.sRecievItem3); if( 0 != info.sRecievItem4.nOverlapped) recvItemSlots[3].SetItem( info.sRecievItem4.nItemTableIdx, info.sRecievItem4.nOverlapped, info.sRecievItem4); readMailInfo = info; if( true == _isGetItemInReadMailInfo()) { btnTakeAll.SetControlState( UIButton.CONTROL_STATE.NORMAL); btnTakeAll.spriteText.Color = new Color(0.1f,0.4f,1.0f,1.0f); } else { btnTakeAll.SetControlState( UIButton.CONTROL_STATE.DISABLED); btnTakeAll.spriteText.Color = Color.gray; } }
private void InitListTab() { listTab.SetActiveRecursively( true); readTab.SetActiveRecursively( false); writeTab.SetActiveRecursively( false); readMailInfo = null; recvItemSlots[0].SetEmpty(); recvItemSlots[1].SetEmpty(); recvItemSlots[2].SetEmpty(); recvItemSlots[3].SetEmpty(); sendItemSlots[0].SetEmpty(); sendItemSlots[1].SetEmpty(); sendItemSlots[2].SetEmpty(); sendItemSlots[3].SetEmpty(); ItemMgr.HadItemManagement.Inven.ResetInvenSlotMoveLock(); if( true == AsHudDlgMgr.Instance.IsOpenInven) AsHudDlgMgr.Instance.invenDlg.ApplySlotMoveLock(); for( int i = 0; i < list.Count; i++) { UIListItemContainer itemContainer = list.GetItem(i) as UIListItemContainer; AsPostBoxListItem listItem = itemContainer.gameObject.GetComponent<AsPostBoxListItem>(); listItem.RefreshInfo(); listItem.CheckCallback = PostItemCheckCallback; } noMail.gameObject.SetActiveRecursively( 0 == list.Count); foreach( AsSlot _slot in recvItemSlots ) { _slot.SetType( AsSlot.SLOT_TYPE.SLT_IT_POST ); } foreach( AsSlot _slot in sendItemSlots ) { _slot.SetType( AsSlot.SLOT_TYPE.SLT_IT_POST ); } }
private void InitWriteTab() { Debug.Log( "InitWriteTab"); listTab.SetActiveRecursively( false); readTab.SetActiveRecursively( false); writeTab.SetActiveRecursively( true); noMail.gameObject.SetActiveRecursively( false); sendTo.Text = ""; sendTitle.Text = ""; sendContent.Text = ""; sendGold.Text = ""; readMailInfo = null; textSendCost.Text = _GetPostCost().ToString( "#,#0", CultureInfo.InvariantCulture); sendGold.gameObject.SetActiveRecursively( false); }
public void InsertMailInfo( body2_SC_POST_LIST_RESULT[] infos) { for( int i = 0; i < infos.Length; i++) { body2_SC_POST_LIST_RESULT info = infos[i]; UIListItemContainer itemContainer = list.CreateItem( itemPrefab) as UIListItemContainer; AsPostBoxListItem listItem = itemContainer.gameObject.GetComponent<AsPostBoxListItem>(); listItem.Parent = this; listItem.SetInfo( info, _GetPostTitle( info, true)); listItem.CheckCallback = PostItemCheckCallback; if( ePostBoxDlgState.ListTab != state) listItem.gameObject.SetActiveRecursively( false); noMail.gameObject.SetActiveRecursively( false); } _initListPanel(); }
private string _GetPostContent(body2_SC_POST_LIST_RESULT info) { string strContent = ""; switch( (ePOSTTYPE)info.nPostType) { case ePOSTTYPE.ePOSTTYPE_NOTHING: strContent = info.content; break; case ePOSTTYPE.ePOSTTYPE_PRIVATE_SHOP: { Item item = ItemMgr.ItemManagement.GetItem( (int)info.nPostSubValue1); if( null != item && null != item.ItemData) { string strItem = AsTableManager.Instance.GetTbl_String(item.ItemData.nameId); strContent = string.Format( AsTableManager.Instance.GetTbl_String(1354), info.content, strItem, info.nPostSubValue2, info.nPostSubValue3); } } break; case ePOSTTYPE.ePOSTTYPE_ATTENDANCE: strContent = AsTableManager.Instance.GetTbl_String(1453); break; case ePOSTTYPE.ePOSTTYPE_RETURN: strContent = AsTableManager.Instance.GetTbl_String(1454); break; case ePOSTTYPE.ePOSTTYPE_INVITE_FRIEND: strContent = AsTableManager.Instance.GetTbl_String(1456); break; case ePOSTTYPE.ePOSTTYPE_GUILD_EXPULSION: strContent = AsTableManager.Instance.GetTbl_String(1458); break; case ePOSTTYPE.ePOSTTYPE_HELLO_SEND: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1501), info.content); break; case ePOSTTYPE.ePOSTTYPE_HELLO_RECV: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1503), info.content); break; case ePOSTTYPE.ePOSTTYPE_HELLO_SEND_RECV: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1505), info.content); break; case ePOSTTYPE.ePOSTTYPE_RECALL_SEND: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1507), info.content); break; case ePOSTTYPE.ePOSTTYPE_RECALL_RECV: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1509), info.content); break; case ePOSTTYPE.ePOSTTYPE_CONNECT_EVENT: strContent = AsTableManager.Instance.GetTbl_String(1511); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_1: strContent = AsTableManager.Instance.GetTbl_String(1743); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_2: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1680), info.content); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_REWARD_1: strContent = AsTableManager.Instance.GetTbl_String(1513); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_REWARD_2: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1677), info.content); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_ACCRUE: strContent = AsTableManager.Instance.GetTbl_String(1744); break; case ePOSTTYPE.ePOSTTYPE_CASH_GIFT: strContent = string.Format( AsTableManager.Instance.GetTbl_String(1515), info.content); break; case ePOSTTYPE.ePOSTTYPE_COUPON: strContent = AsTableManager.Instance.GetTbl_String(1519); break; // case ePOSTTYPE.ePOSTTYPE_GUILD_EVENT_GIFT: // strContent = string.Format( AsTableManager.Instance.GetTbl_String(1517)); // break; case ePOSTTYPE.ePOSTTYPE_LEVEL_COMPLETE: strContent = AsTableManager.Instance.GetTbl_String(1522); break; case ePOSTTYPE.ePOSTTYPE_GM_SEND: strContent = info.content; break; case ePOSTTYPE.ePOSTTYPE_WEME_EVENT: strContent = AsTableManager.Instance.GetTbl_String(1524); break; case ePOSTTYPE.ePOSTTYPE_WEME_COMPENSATION: strContent = AsTableManager.Instance.GetTbl_String(1526); break; case ePOSTTYPE.ePOSTTYPE_DAILY_REWARD: { Item item = ItemMgr.ItemManagement.GetItem( (int)info.nPostSubValue1); if( null != item && null != item.ItemData) { string strItem = AsTableManager.Instance.GetTbl_String(item.ItemData.nameId); int nTotalHor = (int)( info.nPostSubValue2 / 3600); int nDay = (int)( nTotalHor / 24); int nHor = (int)( nTotalHor % 24); strContent = string.Format( AsTableManager.Instance.GetTbl_String(2353), strItem, nDay.ToString(), nHor.ToString()); } } break; case ePOSTTYPE.ePOSTTYPE_INDUN_FIRST_REWARD: strContent = AsTableManager.Instance.GetTbl_String(2351); break; } return strContent; }
private string _GetPostTitle(body2_SC_POST_LIST_RESULT info, bool bUseColor) { string strTitle = ""; string strColor = ""; if( true == bUseColor) { if( true == info.bAccount) strColor = Color.yellow.ToString(); else strColor = Color.white.ToString(); } switch( (ePOSTTYPE)info.nPostType) { case ePOSTTYPE.ePOSTTYPE_NOTHING: strTitle = strColor + info.title; break; case ePOSTTYPE.ePOSTTYPE_PRIVATE_SHOP: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1353); break; case ePOSTTYPE.ePOSTTYPE_ATTENDANCE: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1451); break; case ePOSTTYPE.ePOSTTYPE_RETURN: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1452); break; case ePOSTTYPE.ePOSTTYPE_INVITE_FRIEND: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1455); break; case ePOSTTYPE.ePOSTTYPE_GUILD_EXPULSION: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1457); break; case ePOSTTYPE.ePOSTTYPE_HELLO_SEND: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1500); break; case ePOSTTYPE.ePOSTTYPE_HELLO_RECV: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1502); break; case ePOSTTYPE.ePOSTTYPE_HELLO_SEND_RECV: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1504); break; case ePOSTTYPE.ePOSTTYPE_RECALL_SEND: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1506); break; case ePOSTTYPE.ePOSTTYPE_RECALL_RECV: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1508); break; case ePOSTTYPE.ePOSTTYPE_CONNECT_EVENT: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1510); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_1: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1512); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_2: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1512); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_REWARD_1: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1512); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_REWARD_2: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1512); break; case ePOSTTYPE.ePOSTTYPE_RECOMMEND_ACCRUE: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1512); break; case ePOSTTYPE.ePOSTTYPE_CASH_GIFT: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1514); break; case ePOSTTYPE.ePOSTTYPE_COUPON: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1518); break; // case ePOSTTYPE.ePOSTTYPE_GUILD_EVENT_GIFT: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1516); break; case ePOSTTYPE.ePOSTTYPE_LEVEL_COMPLETE: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1521); break; case ePOSTTYPE.ePOSTTYPE_GM_SEND: strTitle = strColor + info.title; break; case ePOSTTYPE.ePOSTTYPE_WEME_EVENT: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1523); break; case ePOSTTYPE.ePOSTTYPE_WEME_COMPENSATION: strTitle = strColor + AsTableManager.Instance.GetTbl_String(1525); break; case ePOSTTYPE.ePOSTTYPE_DAILY_REWARD: strTitle = strColor + AsTableManager.Instance.GetTbl_String(2352); break; case ePOSTTYPE.ePOSTTYPE_INDUN_FIRST_REWARD: strTitle = strColor + AsTableManager.Instance.GetTbl_String(2350); break; } return strTitle; }
private string _GetPostSenderName(body2_SC_POST_LIST_RESULT info) { string strSenderName = ""; if( ePOSTTYPE.ePOSTTYPE_NOTHING == (ePOSTTYPE)(info.nPostType)) { //strSenderName = info.senderName; if( 24 < _GetStringSize( info.senderName)) strSenderName = info.senderName.Substring( 0, info.senderName.Length - 1); else strSenderName = info.senderName; } else strSenderName = AsTableManager.Instance.GetTbl_String(1450); return strSenderName; }
public void DeleteMailListItem( body2_SC_POST_LIST_RESULT info) { List<body2_CS_POST_DELETE> bodies = new List<body2_CS_POST_DELETE>(); bodies.Add( new body2_CS_POST_DELETE( info.nPostSerial)); body1_CS_POST_DELETE postDelete = new body1_CS_POST_DELETE( curPage, bodies.ToArray()); byte[] data = postDelete.ClassToPacketBytes(); AsNetworkMessageHandler.Instance.Send( data); for( int i = 0; i < list.Count; i++) { UIListItemContainer itemContainer = list.GetItem(i) as UIListItemContainer; AsPostBoxListItem listItem = itemContainer.gameObject.GetComponent<AsPostBoxListItem>(); if( listItem.Info.nPostSerial == info.nPostSerial) { list.RemoveItem( itemContainer, true); break; } } if( 0 == list.Count) noMail.gameObject.SetActiveRecursively( true); }