Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

pun 2 matchmaking custom room properties

using Photon.Realtime;
using System.Collections.Generic;
using Hashtable = ExitGames.Client.Photon.Hashtable;

public class CreateRoomWithLobbyPropertiesExample : IMatchmakingCallbacks
{
    public const string MAP_PROP_KEY = "map";
    public const string GAME_MODE_PROP_KEY = "gm";
    public const string AI_PROP_KEY = "ai";

    private LoadBalancingClient loadBalancingClient;

    private void CreateRoom()
    {
        RoomOptions roomOptions = new RoomOptions();
        roomOptions.CustomRoomPropertiesForLobby = { MAP_PROP_KEY, GAME_MODE_PROP_KEY, AI_PROP_KEY };
        roomOptions.CustomRoomProperties = new Hashtable { { MAP_PROP_KEY, 1 }, { GAME_MODE_PROP_KEY, 0 } };
        EnterRoomParams enterRoomParams = new EnterRoomParams();
        enterRoomParams.RoomOptions = roomOptions;
        loadBalancingClient.OpCreateRoom(enterRoomParams);
    }

    // do not forget to register callbacks via loadBalancingClient.AddCallbackTarget
    // also deregister via loadBalancingClient.RemoveCallbackTarget
    #region IMatchmakingCallbacks

    void IMatchmakingCallbacks.OnCreateRoomFailed(short returnCode, string message)
    {
       // log error message and code
    }

    void IMatchmakingCallbacks.OnCreatedRoom()
    {
    }

    void IMatchmakingCallbacks.OnJoinedRoom()
    {
        // joined a room successfully, OpCreateRoom leads here on success
    }

    // [..] Other callbacks implementations are stripped out for brevity, they are empty in this case as not used.

    #endif
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: use Multiple forms in one Csharp panel in one Windows Form panel 
Csharp :: Jeng InitDb 
Csharp :: show in editor unity 
Csharp :: c# unzip all archive files inside directory 
Csharp :: c# how to convert string to float 
Csharp :: beard styles without mustache Intitle:work with me 
Csharp :: asp.net core user.identity.name is null 
Csharp :: permutation and combination program in c# 
Csharp :: sqlsinifi.baglanti.open() 
Csharp :: c# Detect Cycle in a Directed Graph 
Csharp :: delete an object c# 
Csharp :: unity manager.instance 
Csharp :: send to main args dotnet debug 
Csharp :: asp.net Read raw Body 
Csharp :: how to destroy bridges animal crossing 
Csharp :: entity save example in c# model first 
Csharp :: reflection assemblies gettypes 
Csharp :: c# linq aggregate string builder 
Csharp :: Get the Default gateway address c# 
Csharp :: c# sort word 
Csharp :: if equal statement c# 
Csharp :: C# parallel for loop specify cores 
Csharp :: eager loading singleton c# dependency injection 
Csharp :: Cursor Invisibility 
Csharp :: how to add logo in a unity game apk 
Csharp :: c# webbrowser control append 
Csharp :: calculate 01 with min max value 
Csharp :: c# dubble comment 
Csharp :: vb.net how insert event inside an event 
Csharp :: unity transform.translate 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =