本文整理汇总了C#中MessageEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# MessageEventArgs类的具体用法?C# MessageEventArgs怎么用?C# MessageEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageEventArgs类属于命名空间,在下文中一共展示了MessageEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnItemClicked
void OnItemClicked(MessageEventArgs args)
{
int itemID = args.GetMessage<int>("ItemID");
ItemData itemData = DataManager.Instance.GetItemDataSet().GetItemData(itemID);
args.AddMessage ("Message", itemData.description);
EventManager.Instance.PostEvent (UIEvent.OnMessageSet, args);
}
示例2: EnterBattle
/*UI CALLBACK*/
public void EnterBattle(int battleType)
{
MessageEventArgs arg = new MessageEventArgs();
arg.AddMessage("WindowID", UIWindowID.BattleWindow);
EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, arg);
MessageEventArgs args = new MessageEventArgs ();
args.AddMessage("BattleType",battleType);
if(battleType == 0)
{
args.AddMessage("Man",true);
args.AddMessage("Girl",true);
args.AddMessage("Enemy",new int[3]{101,102,103});
}
else if(battleType == 1)
{
args.AddMessage("Man",true);
args.AddMessage("Girl",true);
args.AddMessage("Enemy",new int[1]{104});
}
else
{
args.AddMessage("Man",true);
args.AddMessage("Enemy",new int[1]{105});
}
EventManager.Instance.PostEvent (BattleEvent.OnBattleEnter, args);
}
示例3: OnMessageEvent
private void OnMessageEvent(string messagetype, string message)
{
MessageEventArgs mea = new MessageEventArgs();
mea.messagetype = messagetype;
mea.message = message;
OnMessage.BeginInvoke(this, mea, null, null);
}
示例4: OnCommandShowUp
void OnCommandShowUp(MessageEventArgs args)
{
commandPanel.SetActive(true);
subCommandPanel.SetActive (true);
commandPanel.GetComponent<CommandPanelUIEvent>().SetButtonActive();
EventManager.Instance.PostEvent(UIEvent.OnMessageHide);
}
示例5: changeResourceStock
public bool changeResourceStock(object sender, MessageEventArgs e, TypeResource resourceType, int value)
{
//Debug.Log("Changing resource stock : " + resourceType.ToString() + " - " + value.ToString());
char islandNumber = ((string)e.message.Split('@').GetValue(1))[1];
if (!gameObject.name.Contains(islandNumber))
{
//Island not concerned
return false;
}
//Debug.Log("Stock update : " + e.message);
Resource resource = this.getResource(resourceType);
bool result = false;
if (resource != null)
{
result = resource.changeStock(value);
}
else
{
if (value >= 0)
{
this.addResource(resourceType, value);
result = true;
}
else
{
return false;
}
}
//The board shouldn't notice the network of an gloabl stock update
if(this.ChangeResourceStockEvent != null) // && result)
{
this.ChangeResourceStockEvent(this, new ChangeResourceStockEventArgs { resourceType = resourceType, stock = value }); // resource.Stock });
}
return result;
}
示例6: onMessageReceived
void onMessageReceived(object sender, MessageEventArgs e)
{
try
{
var json = JSON.Parse(e.Data.Substring(2));
string tag = json.AsArray[0];
JSONNode objJson = json.AsArray[1];
switch (tag) {
// from web client
case "obj" :
int objType = objJson["id"].AsInt;
int position = objJson["pos"].AsInt;
resources.Add(new ResourceObject(objType, position));
break;
// from unity, so this would be other unity clients. May handle in future
case "pos" :
break;
case "score":
break;
case "invW":
break;
case "invR":
break;
case "invG":
break;
default :
break;
}
}
catch (System.Exception error) {/* Debug.log(error.StackTrace) */ }
}
示例7: OpenUIWindow
void OpenUIWindow(MessageEventArgs args)
{
UIWindowID windowID = args.GetMessage<UIWindowID>("WindowID");
if(windowStack.Count > 0)
{
GameObject lastWindow = windowStack[windowStack.Count - 1];
CanvasGroup canvasGroup = lastWindow.GetComponent<CanvasGroup>();
canvasGroup.alpha = 1;
canvasGroup.DOFade(0, 0.25f).OnComplete(()=>{lastWindow.SetActive(false);});
}
GameObject window = windowStack.Find((GameObject x)=>{return x.name.Contains(windowID.ToString());});
if(window != null)
{
window.SetActive(true);
windowStack.Remove(window);
windowStack.Add(window);
}
else
{
window = GameObject.Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_WINDOW + windowID.ToString()) as GameObject);
windowStack.Add(window);
}
if(windowStack.Count > 1)
{
CanvasGroup canvasGroup = window.GetComponent<CanvasGroup>();
canvasGroup.alpha = 0;
canvasGroup.DOFade(1, 0.5f);
}
}
示例8: CustomMessageControl
/// <summary>
/// Constructor that takes the given message event args, bilingual document, source segment and target segment.
/// </summary>
/// <param name="messageEventArgs">message event arguments</param>
/// <param name="bilingualDocument">bilingual document</param>
/// <param name="sourceSegment">source segment</param>
/// <param name="targetSegment">target segment</param>
public CustomMessageControl(MessageEventArgs messageEventArgs, IBilingualDocument bilingualDocument, ISegment sourceSegment, ISegment targetSegment)
{
MessageEventArgs = messageEventArgs;
BilingualDocument = bilingualDocument;
SourceSegment = sourceSegment;
TargetSegment = targetSegment;
InitializeComponent();
_sourceSegmentControl.Dock = DockStyle.Fill;
_sourceSegmentPanel.Controls.Add(_sourceSegmentControl);
_targetSegmentControl.Dock = DockStyle.Fill;
_targetSegmentPanel.Controls.Add(_targetSegmentControl);
UpdateMessage(messageEventArgs);
UpdateSourceSegment(sourceSegment);
UpdateTargetSegment((ISegment)targetSegment.Clone());
UpdateProblemDescription(messageEventArgs);
UpdateSuggestions(messageEventArgs);
// make the target segment editable
_targetSegmentControl.IsReadOnly = false;
_suggestionsList.SelectedIndexChanged += _suggestionsList_SelectedIndexChanged;
}
示例9: printMsg
public void printMsg(MessageEventArgs e)
{
if (e.messageSet)
{
Message receivedMsg = e.newMessage;
String user = receivedMsg.sndUser.username;
String time = AddUserTime(user, false);
String messageStr;
if (chatUser.isPasswordProtected())
{
String encStr = receivedMsg.messageStr;
messageStr = Message.xorMsg(encStr, chatUser.getPassword());
}
else
{
messageStr = receivedMsg.messageStr;
}
DisplayMsg(time, messageStr, user);
// Memory handle
time = null;
}
}
示例10: OnChannelOpenFailure
private void OnChannelOpenFailure(object sender, MessageEventArgs<ChannelOpenFailureMessage> e)
{
if (e.Message.LocalChannelNumber == this.LocalChannelNumber)
{
this.OnOpenFailure(e.Message.ReasonCode, e.Message.Description, e.Message.Language);
}
}
示例11: Session_MessageReceived
private void Session_MessageReceived(object sender, MessageEventArgs<Message> e)
{
var groupMessage = e.Message as KeyExchangeDhGroupExchangeGroup;
if (groupMessage != null)
{
// Unregister message once received
this.Session.UnRegisterMessage("SSH_MSG_KEX_DH_GEX_GROUP");
// 2. Receive SSH_MSG_KEX_DH_GEX_GROUP
this._prime = groupMessage.SafePrime;
this._group = groupMessage.SubGroup;
this.PopulateClientExchangeValue();
// 3. Send SSH_MSG_KEX_DH_GEX_INIT
this.Session.SendMessage(new KeyExchangeDhGroupExchangeInit(this._clientExchangeValue));
}
var replyMessage = e.Message as KeyExchangeDhGroupExchangeReply;
if (replyMessage != null)
{
// Unregister message once received
this.Session.UnRegisterMessage("SSH_MSG_KEX_DH_GEX_REPLY");
this.HandleServerDhReply(replyMessage.HostKey, replyMessage.F, replyMessage.Signature);
// When SSH_MSG_KEX_DH_GEX_REPLY received key exchange is completed
this.Finish();
}
}
示例12: OnMessageSet
void OnMessageSet(MessageEventArgs args)
{
string msg = args.GetMessage<string>("Message");
message.text = msg;
msgList.Clear();
msgList.Add(msg);
}
示例13: OnChannelOpenConfirmation
private void OnChannelOpenConfirmation(object sender, MessageEventArgs<ChannelOpenConfirmationMessage> e)
{
if (e.Message.LocalChannelNumber == this.LocalChannelNumber)
{
this.OnOpenConfirmation(e.Message.RemoteChannelNumber, e.Message.InitialWindowSize, e.Message.MaximumPacketSize);
}
}
示例14: SocketMessage
private void SocketMessage(object sender, MessageEventArgs e)
{
if ( e!= null && e.Message.Event == "message") {
string msg = e.Message.MessageText;
Debug.Log("socket message: " + msg);
}
}
示例15: OnMarketPricesStreamMessageReceived
private void OnMarketPricesStreamMessageReceived(object sender, MessageEventArgs<PriceDTO> e)
{
if (!_listening) return;
Dispatcher.BeginInvoke(() => listBox1.Items.Add("anonymous price arrived!"));
Dispatcher.BeginInvoke(() => button1.IsEnabled = true);
_listening = false;
}