Esempio n. 1
0
    public void SetOpponentID()
    {
        print(id == userId.value + "" + !IsOnline() + "" + !IsFree() + "" + !PhotonNetwork.connected);
        ObliusGameManager.isFriendlyBattle = true;
        if (id == userId.value || !IsOnline() || !IsFree() || !PhotonNetwork.connected)
        {
            return;
        }
        opponentId.value   = id;
        opponentName.value = playerName.text;
        var regions = data.PING.ToRegions();
        List <PhotonRegion> myRegions = PhotonPingManager.ping.ToRegions();
        List <PhotonRegion> result    = new List <PhotonRegion>();

        for (int i = 0; i < regions.Count; i++)
        {
            PhotonRegion r = new PhotonRegion();
            r.region = regions[i].region;
            r.ping   = regions[i].ping + myRegions[i].ping;
            result.Add(r);
        }
        result       = result.OrderBy(a => a.ping).ToList();
        server.value = result[0].region;
        challengeLoadingON.Fire();
    }
Esempio n. 2
0
 public ConnectionDetails(string appID, string appVersion, PhotonRegion region = PhotonRegion.None, string nameserverhost = "ns.exitgames.com", Authorization auth = null)
 {
     AppID          = appID;
     AppVersion     = appVersion;
     Region         = region;
     NameServerHost = nameserverhost;
     Authentication = auth;
 }
Esempio n. 3
0
    public void initRegion(EServerRegion region, bool isCheck)
    {
        GameObject obj = Instantiate(regionPrefab, transform);

        PhotonRegion newRegion = obj.GetComponent <PhotonRegion>();

        newRegion.init(region, isCheck);

        regionList.Add(newRegion);
    }
Esempio n. 4
0
 public void ChangeMasterServer(string regionToken)
 {
     BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig
     {
         AppId             = "8e1f090e-e0ff-4166-9ebe-6693470ecc07", // your App ID
         Region            = PhotonRegion.GetRegion(regionToken),    // your desired region
         UsePunchThrough   = true,                                   // enable the punch through feature
         RoomUpdateRate    = 5,                                      // session update rate
         RoomCreateTimeout = 10,                                     // timeout when creating a room
         RoomJoinTimeout   = 10                                      // timeout when joining a room
     }));
 }
Esempio n. 5
0
    public static void SetRegion(int regionID)
    {
        PhotonRegion region = PhotonRegion.GetRegion((PhotonRegion.Regions)regionID);

        Debug.Log("[BOLT] New region set : " + region + ".");

        BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig
        {
            AppId             = "580c5d6e-2793-48b2-b0e0-7eb1272407f5",
            Region            = region,
            RoomCreateTimeout = 10,
            RoomJoinTimeout   = 10,
            RoomUpdateRate    = 1,
            UsePunchThrough   = true
        }));
    }
Esempio n. 6
0
    public static List <PhotonRegion> ToRegions(this string str)
    {
        List <PhotonRegion> list = new List <PhotonRegion> ();

        string[] regionAndPing = str.Split('|');
        foreach (var r in regionAndPing)
        {
            PhotonRegion region = new PhotonRegion();
            if (!string.IsNullOrEmpty(r))
            {
                string[] split = r.Split('.');
                region.region = split [0];
                region.ping   = int.Parse(split [1]);
                list.Add(region);
            }
        }
        return(list);
    }