本文整理汇总了C#中BaseEvent类的典型用法代码示例。如果您正苦于以下问题:C# BaseEvent类的具体用法?C# BaseEvent怎么用?C# BaseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseEvent类属于命名空间,在下文中一共展示了BaseEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnExtensionResponse
//------------------------------------------------------------------------------------
/**
* Handle responses from server side Extension.
*/
public void OnExtensionResponse(BaseEvent evt)
{
string cmd = (string)evt.Params["cmd"];
SFSObject dataObject = (SFSObject)evt.Params["params"];
switch ( cmd ) {
case "start":
StartGame(dataObject.GetInt("t"),
dataObject.GetInt("p1i"),
dataObject.GetInt("p2i"),
dataObject.GetUtfString("p1n"),
dataObject.GetUtfString("p2n")
);
break;
case "stop":
UserLeft();
break;
case "move":
MoveReceived(dataObject.GetInt("t"), dataObject.GetInt("x"), dataObject.GetInt("y"));
break;
case "win":
ShowWinner(cmd, (int)dataObject.GetInt("w"));
break;
case "tie":
ShowWinner(cmd, -1);
break;
}
}
开发者ID:nvnjls,项目名称:MyFancyBoard,代码行数:36,代码来源:TrisGame.cs
示例2: OnUserVariableUpdate
// When user variable is updated on any client, then this callback is being received
// This is where most of the magic happens
private void OnUserVariableUpdate(BaseEvent e)
{
SFSUser user = e.Params.GetSFSUser();
if (user == smartfox.MySelf) return;
if (!remotePlayers.ContainsKey(user)) return;
ArrayList changedVars = e.Params.GetChangedVars();
// Check if the remote user changed his position or rotation
if (changedVars.Contains("x") || changedVars.Contains("y") || changedVars.Contains("z") || changedVars.Contains("rot"))
{
// Move the character to a new position...
Vector3 pos = new Vector3((float)user.GetVariable("x").GetDoubleValue(), 1, (float)user.GetVariable("z").GetDoubleValue());
Quaternion quat = Quaternion.Euler(0, (float)user.GetVariable("rot").GetDoubleValue(), 0);
SimpleRemoteInterpolation interp = remotePlayers[user].GetComponent<SimpleRemoteInterpolation>();
interp.SetTransform(pos, quat, true);
}
// Remote client got new name?
if (changedVars.Contains("name"))
{
remotePlayers[user].GetComponentInChildren<TextMesh>().text = user.Name;
}
}
开发者ID:BerengerMantoue,项目名称:SmartfoxDemo,代码行数:28,代码来源:NonAutoMMOGame.cs
示例3: OnExtensionResponse
private void OnExtensionResponse(BaseEvent evt)
{
try
{
String ResponseType = (string)evt.Params["cmd"];
Debug.Log("Received Response: " + ResponseType);
ISFSObject ObjectIn = (SFSObject)evt.Params["params"];
if(ResponseType == "CharacterList")
{
for(int i = 0; i < ObjectIn.GetUtfStringArray("NameList").Length; i++)
{
float posY = 200 - (50 + (80 * i));
//Debug.Log(posY);
CharacterPanel.Add((GameObject)Instantiate(Resources.Load("UI/CharacterPanel", typeof(GameObject))));
CharacterPanel[i].GetComponent<RectTransform>().parent = this.CharacterListPanel.GetComponent<RectTransform>();
CharacterPanel[i].GetComponent<RectTransform>().localPosition = new Vector3(0, posY, 0);
CharacterPanel[i].GetComponentInChildren<Text>().text = ObjectIn.GetUtfStringArray("NameList")[i];
GameObject aCP = CharacterPanel[i];
CharacterPanel[i].GetComponent<Button>().onClick.AddListener(() => CharacterPanel_Clicked(aCP));
}
}
}
catch(Exception e)
{
Debug.Log("Exception handling response: " + e.Message + " >>> " + e.StackTrace);
}
}
开发者ID:Gabe-Biele,项目名称:Project-Circleage,代码行数:28,代码来源:CharacterSelection.cs
示例4: OnConnection
void OnConnection(BaseEvent evt)
{
bool connectionSuccess = (bool)evt.Params["success"];
Debug.Log("OnConn:" + connectionSuccess);
if (connectionSuccess)
{
SFSObject loginData = new SFSObject();
loginData.PutUtfString("username", usernameField.value);
loginData.PutUtfString("password", passwordField.value);
sfs.Send(new Sfs2X.Requests.LoginRequest("", "", "MainZone", loginData));
connectionWindow.SetActive(false);
loggingWindow.SetActive(true);
}
else
{
sfs = Connection.Instance().Reset();
SetupListeners();
loginWindow.SetActive(true);
connectionWindow.SetActive(false);
}
}
开发者ID:lukebitts,项目名称:AcidProject,代码行数:26,代码来源:Login.cs
示例5: OnLogin
public void OnLogin(BaseEvent evt)
{
Debug.Log("Logged in successfully");
// We either create the Game Room or join it if it exists already
smartFox.Send(new JoinRoomRequest("The Game"));
}
开发者ID:wajidtarar,项目名称:warofgodsemblem,代码行数:7,代码来源:ConnectionGUI.cs
示例6: OnConnection
void OnConnection(BaseEvent e)
{
if ((bool)e.Params ["success"]) {
Debug.Log ("Successfully Connected!");
UnityEngine.UI.Text connectionMessage = GameObject.Find ("ConnectionMessage").GetComponent<UnityEngine.UI.Text> ();
connectionMessage.text = "Connection Successful! \nSelect a player...";
GameObject tetrisButton = GameObject.Find ("Tetris");
GameObject breakoutButton = GameObject.Find ("Breakout");
GameObject platformButton = GameObject.Find ("Platformer");
GameObject connectionButton = GameObject.Find ("Connect");
GameObject observerButton = GameObject.Find ("Observer");
GameObject textField = GameObject.Find ("ServerIPInputField");
tetrisButton.GetComponent<UnityEngine.UI.Image> ().enabled = true;
breakoutButton.GetComponent<UnityEngine.UI.Image> ().enabled = true;
platformButton.GetComponent<UnityEngine.UI.Image> ().enabled = true;
observerButton.GetComponent<UnityEngine.UI.Image> ().enabled = true;
sfs.Send(new LoginRequest(Username, "", ZoneName));
}
else{
UnityEngine.UI.Text connectionMessage = GameObject.Find ("ConnectionMessage").GetComponent<UnityEngine.UI.Text> ();
connectionMessage.text = "Connection failed.";
Debug.Log ("Connection Failed");
}
}
开发者ID:xzs424,项目名称:PunchMe,代码行数:27,代码来源:Networking.cs
示例7: OnConnectionLost
public void OnConnectionLost(BaseEvent evt)
{
Debug.LogError ("Lost server connection, reconnecting..");
// Reset all internal states so we kick back to login screen
server.RemoveAllEventListeners ();
Application.LoadLevel ("Connector");
}
开发者ID:connollyst,项目名称:little,代码行数:7,代码来源:GameManager.cs
示例8: OnUserEnterRoom
private void OnUserEnterRoom(BaseEvent e)
{
User user = e.Params.GetUser();
print("OnUserEnterRoom : " + user.Name);
OnUserEnteredRoom(user);
}
开发者ID:BerengerMantoue,项目名称:SmartfoxDemo,代码行数:7,代码来源:SFSRoomDemo.cs
示例9: OnUserVariablesUpdate
private void OnUserVariablesUpdate(BaseEvent evt)
{
ArrayList changedVars = (ArrayList)evt.Params["changedVars"];
SFSUser user = (SFSUser)evt.Params["user"];
Debug.Log(user.Id);
if(!users.ContainsKey(user.Id))
{
Debug.LogWarning("Got variable update for an user that is not in the users list.");
return;
}
if (changedVars.Contains("x") || changedVars.Contains("y") || changedVars.Contains("z"))
{
GameObject playerGo = user.Properties["GameObject"] as GameObject;
Vector3 newPosition = new Vector3();
newPosition.x = (float)user.GetVariable("x").GetDoubleValue();
newPosition.y = (float)user.GetVariable("y").GetDoubleValue();
newPosition.z = (float)user.GetVariable("z").GetDoubleValue();
playerGo.transform.position = newPosition;
}
}
开发者ID:lukebitts,项目名称:AcidProject,代码行数:26,代码来源:MultiplayerManager.cs
示例10: OnConnectionLost
public void OnConnectionLost(BaseEvent evt)
{
Debug.Log("OnConnectionLost");
isLoggedIn = false;
currentActiveRoom = null;
UnregisterSFSSceneCallbacks();
}
开发者ID:haly,项目名称:Blackjack,代码行数:7,代码来源:Lobby.cs
示例11: getActivableEvents
public BaseEvent[] getActivableEvents()
{
int counter=0;
if (associatedPart != null)
{
foreach (PartModule pm in associatedPart.GetComponents<PartModule>())
{
foreach (BaseEvent mEvent in pm.Events)
{
if (mEvent.guiActive & mEvent.active) counter++;
}
}
BaseEvent[] events = new BaseEvent[counter];
counter = 0;
foreach (PartModule pm in associatedPart.GetComponents<PartModule>())
{
foreach (BaseEvent mEvent in pm.Events)
{
if (mEvent.guiActive & mEvent.active)
{
events[counter] = mEvent;
counter++;
}
}
}
return events;
}
else return new BaseEvent[0];
}
开发者ID:icedown,项目名称:VesselViewer,代码行数:29,代码来源:CustomPartTreeItem.cs
示例12: OnUserEnterRoom
void OnUserEnterRoom(BaseEvent e)
{
Debug.Log ("User Enter Room");
SmartfoxUtil.CheckParam (e.Params);
SFSUser user = (SFSUser)e.Params ["user"];
CreateRemotePlayer (user,Vector3.zero);
}
开发者ID:Chongcharen,项目名称:MadnessFotball,代码行数:7,代码来源:GameNetworkManager.cs
示例13: OnLogout
protected override void OnLogout(BaseEvent e)
{
base.OnLogout(e);
chat.roomList.Clear();
chat.zoneMode = 0;
}
开发者ID:BerengerMantoue,项目名称:SmartfoxDemo,代码行数:7,代码来源:AuthoChat.cs
示例14: OnConnectionLost
/// <summary>
/// When connection is lost we load the login scene
/// </summary>
private void OnConnectionLost(BaseEvent evt)
{
UnsubscribeDelegates();
Screen.lockCursor = false;
Screen.showCursor = true;
Application.LoadLevel("Authorization");
}
开发者ID:kimreik,项目名称:Snow,代码行数:10,代码来源:LobbyNetworkManager.cs
示例15: GetStreamName
private string GetStreamName(BaseEvent @event)
{
var id = @event.AggregateRootId.ToString();//.Replace('-','_'); // Category name baseras på senaste dashen i streamname, därför kan inte ID:t innehålla en dash.
var aggregateType = @event.AggregateRootType.Name;
return $"{aggregateType}-{id}";
}
开发者ID:adamfur,项目名称:CqrsLab,代码行数:7,代码来源:Program.cs
示例16: OnRoomJoin
protected override void OnRoomJoin(BaseEvent e)
{
base.OnRoomJoin(e);
chat.roomMode = 1;
RefreshUserList();
}
开发者ID:BerengerMantoue,项目名称:SmartfoxDemo,代码行数:7,代码来源:AuthoChat.cs
示例17: OnProximityListUpdate
public void OnProximityListUpdate(BaseEvent evt)
{
var addedUsers = (List<User>)evt.Params ["addedUsers"];
var addedItems = (List<IMMOItem>)evt.Params ["addedItems"];
var removedUsers = (List<User>)evt.Params ["removedUsers"];
var removedItems = (List<IMMOItem>)evt.Params ["removedItems"];
foreach (User user in addedUsers) {
Debug.Log ("Proximity user added: " + user);
}
foreach (User user in removedUsers) {
Debug.Log ("Proximity user removed: " + user);
}
foreach (IMMOItem item in addedItems) {
Debug.Log ("Proximity item added: " + item);
string type = item.GetVariable ("type").GetStringValue ();
if (type == "wall") {
AddWall (item);
} else if (type == "player") {
AddPlayer (item);
} else if (type == "entity") {
AddItem (item);
}
}
foreach (IMMOItem item in removedItems) {
Debug.Log ("Proximity item removed: " + item);
string type = item.GetVariable ("type").GetStringValue ();
if (type == "player") {
RemovePlayer (item);
} else if (type == "entity") {
RemoveItem (item);
}
}
}
开发者ID:connollyst,项目名称:little,代码行数:33,代码来源:GameManager.cs
示例18: OnJoinRoom
public void OnJoinRoom(BaseEvent evt)
{
Room room = (Room)evt.Params["room"];
currentActiveRoom = room;
Debug.Log("onjoinroom = " + currentActiveRoom.Name);
if (room.Name == "The Lobby")
Application.LoadLevel(room.Name);
else if (room.IsGame)
{
//Debug.Log("is game!!!!");
//store my own color on server as user data
List<UserVariable> uData = new List<UserVariable>();
uData.Add(new SFSUserVariable("playerID", GameValues.playerID));
smartFox.Send(new SetUserVariablesRequest(uData));
Application.LoadLevel("testScene");
}
else
{
Debug.Log("GameLobby- OnJoinRoom: joined " + room.Name);
Application.LoadLevel("Game Lobby");
Debug.Log("loading Game Lobby");
//smartFox.Send(new SpectatorToPlayerRequest());
}
}
开发者ID:ice0001,项目名称:Cubes-in-Space,代码行数:26,代码来源:GameLobby.cs
示例19: OnProximityListUpdate
private void OnProximityListUpdate(BaseEvent evt)
{
Debug.Log("OnProximityListUpdate");
var added = evt.Params["addedUsers"] as List<User>;
var removed = evt.Params["removedUsers"] as List<User>;
foreach(User user in added) {
var entryPoint = user.AOIEntryPoint;
GameObject playerGo = Instantiate(networkPlayerPrefab, new Vector3(entryPoint.FloatX, entryPoint.FloatY, entryPoint.FloatZ), Quaternion.identity) as GameObject;
user.Properties.Add("GameObject", playerGo);
users.Add(user.Id, user);
}
foreach(User user in removed)
{
object playerObj;
user.Properties.TryGetValue("GameObject", out playerObj);
GameObject playerGo = playerObj as GameObject;
DestroyImmediate(playerGo);
users.Remove(user.Id);
}
}
开发者ID:lukebitts,项目名称:AcidProject,代码行数:27,代码来源:MultiplayerManager.cs
示例20: OnRoomVariablesUpdate
public void OnRoomVariablesUpdate(BaseEvent evt)
{
//Debug.Log("ROOM VARS");
Room room = (Room)evt.Params["room"];
ArrayList changedVars = (ArrayList)evt.Params["changedVars"];
if (!GameValues.isHost)
{
// Check if the "gameStarted" variable was changed
if (changedVars.Contains("gameStarted"))
{
if (room.GetVariable("gameStarted").GetBoolValue() == true)
{
Debug.Log("Game started in room vars");
String[] nameParts = this.currentActiveRoom.Name.Split('-');
Debug.Log(nameParts[0] + " - Game");
smartFox.Send(new JoinRoomRequest(nameParts[0] + " - Game", "", CurrentActiveRoom.Id));
}
else
{
Debug.Log("Game stopped");
}
}
}
}
开发者ID:ice0001,项目名称:Cubes-in-Space,代码行数:25,代码来源:GameLobby.cs
注:本文中的BaseEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论