コールバック


using SoftGear.Strix.Client.Core;
using SoftGear.Strix.Client.Match.Room.Model;
using SoftGear.Strix.Client.Room;
using SoftGear.Strix.Client.Room.Message;
using SoftGear.Strix.Unity.Runtime;
using SoftGear.Strix.Unity.Runtime.Event;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Callback : MonoBehaviour
{
    // ネットワークに繋げる前にやる サーバーを1度抜けて入りなおす場合にもやる
    void Start()
    {
        StrixNetwork.instance.roomSession.Connected += Connected;
        StrixNetwork.instance.roomSession.Closed += Closed;
        StrixNetwork.instance.roomSession.roomClient.RoomCreated += RoomCreated;
        StrixNetwork.instance.roomSession.roomClient.RoomJoined += RoomJoined;
        StrixNetwork.instance.roomSession.roomClient.RoomJoinNotified += RoomJoinNotified;
        StrixNetwork.instance.roomSession.roomClient.RoomLeaveNotified += RoomLeaveNotified;
    }

    public void Connected(StrixNetworkConnectEventArgs args)
    {
        Debug.Log("サーバーに接続しました");
    }

    public void Closed(StrixNetworkCloseEventArgs args)
    {
        Debug.Log("サーバーから切断しました");
    }

    public void RoomCreated(RoomCreatedEventArgs<CustomizableMatchRoom> notification)
    {
        Debug.Log("ルームを作成しました");
    }

    public void RoomJoined(RoomJoinedEventArgs<CustomizableMatchRoom, CustomizableMatchRoomMember> notification)
    {
        Debug.Log("他人のルームに入りました");
    }

    public void RoomJoinNotified(NotificationEventArgs<RoomJoinNotification<CustomizableMatchRoom>> notification)
    {
        Debug.Log("他のメンバーがルームに入りました");
    }

    public void RoomLeaveNotified(NotificationEventArgs<RoomLeaveNotification<CustomizableMatchRoom>> notification
    )
    {
        Debug.Log("他のメンバーがルームから抜けました");
    }
}

戻る