当前位置: 首页>>代码示例>>C#>>正文


C# BaseEvent类代码示例

本文整理汇总了C#中BaseEvent的典型用法代码示例。如果您正苦于以下问题:C# BaseEvent类的具体用法?C# BaseEvent怎么用?C# BaseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseEvent类属于命名空间,在下文中一共展示了BaseEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的BaseEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。