Exemplo n.º 1
0
    IEnumerator waitlvl()
    {
        yield return(info_s = INC.la("conected_photon_server"));

        INC.Conected();
        yield return(new WaitForSeconds(0.2f));

        RoomInfo[] info      = PhotonNetwork.GetRoomList();
        int        count_con = 0;

        while (info.Length == 0)
        {
            if (count_con > 20)
            {
                yield return(info_s = INC.la("time_out_conected_photon_server"));

                yield return(new WaitForSeconds(2f));

                Destroy(base.gameObject);
            }
            yield return(new WaitForSeconds(0.1f));

            count_con = count_con + 1;
            info      = PhotonNetwork.GetRoomList();
            yield return(null);
        }
        yield return(new WaitForSeconds(0.2f));

        yield return(info_s = INC.la("find_server") + name_server.toHex().Resize(15) + "...");

        int count = 0;

        while (true)
        {
            if (count > 10)
            {
                yield return(info_s = INC.la("server_not_found"));

                yield return(new WaitForSeconds(2f));

                Destroy(base.gameObject);
            }
            foreach (RoomInfo inf in info)
            {
                if (id_server == inf.IDRoom && name_server == inf.RoomName && map_server == inf.MapName && diff_server == inf.Difficulty && day_server == inf.DayTime && password == inf.Password)
                {
                    if (inf.playerCount < inf.maxPlayers)
                    {
                        PhotonNetwork.JoinRoom(inf.name);
                        yield return(info_s = INC.la("conected_to_retry_server") + name_server.toHex().Resize(15) + "...");

                        yield return(new WaitForSeconds(2f));

                        Destroy(base.gameObject);
                    }
                    else
                    {
                        yield return(info_s = INC.la("retry_server_is_full"));

                        yield return(new WaitForSeconds(2f));

                        Destroy(base.gameObject);
                    }
                }
            }
            yield return(new WaitForSeconds(0.1f));

            count = count + 1;
            info  = PhotonNetwork.GetRoomList();
            yield return(null);
        }
    }
Exemplo n.º 2
0
    void SearhSettings()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label(INC.la("filter_cyan_ser_list"));
        if (GUILayout.Button("UPD", GUILayout.Width(34f)))
        {
            UpdList();
            PanelInformer.instance.Add(INC.la("server_list_upd"), PanelInformer.LOG_TYPE.INFORMAION);
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        string s = Filter;

        Filter = GUILayout.TextField(Filter);
        if (s != Filter)
        {
            UpdList();
        }
        if (GUILayout.Button("x", GUILayout.Width(30f)))
        {
            Filter = "";
            UpdList();
        }
        GUILayout.EndHorizontal();
        if (searshing.Length > 0)
        {
            GUILayout.BeginHorizontal();

            foreach (string ssd in searshing)
            {
                if (GUILayout.Button(ssd, new GUIStyle(GUI.skin.button)
                {
                    alignment = TextAnchor.MiddleLeft
                }, GUILayout.Width(70f)))
                {
                    Filter = ssd;
                    UpdList();
                }
            }

            GUILayout.EndHorizontal();
        }
        posCyanSearhList = GUILayout.BeginScrollView(posCyanSearhList);

        GUICyan.OnToogleCyan(INC.la("show_pass_csl"), 275, 1, 0, 50f);
        GUICyan.OnToogleCyan(INC.la("show_full_csl"), 276, 1, 0, 50f);
        if (INC.ServerPrivated != "")
        {
            int i = (int)FengGameManagerMKII.settings[368];
            GUICyan.OnToogleCyan(INC.la("private_server"), 368, 1, 0, 50f);
            if (i != (int)FengGameManagerMKII.settings[368])
            {
                INC.Conected();
            }
        }
        if (GUILayout.Button(INC.la("random_server_ps")))
        {
            RoomInfo[] rm = PhotonNetwork.GetRoomList();
            if (rm.Length > 0)
            {
                List <RoomInfo> list = new List <RoomInfo>();
                foreach (RoomInfo info in rm)
                {
                    if (info.playerCount < info.maxPlayers && info.Password == "")
                    {
                        list.Add(info);
                    }
                }
                conected = true;
                PhotonNetwork.JoinRoom(list[UnityEngine.Random.Range(0, list.Count)].name);
            }
        }
        GUILayout.Label(INC.la("sorting_csl"));
        FengGameManagerMKII.settings[272] = GUILayout.SelectionGrid((int)FengGameManagerMKII.settings[272], sort, 2);


        settingSearh(4, 4, INC.la("diff_s_csl"), diff);
        settingSearh(3, 3, INC.la("day_time_s_csl"), day);
        settingSearh(1, 1, INC.la("level_name_csl"), levels);
        settingSearh(2, 2, INC.la("map_name_csl"), mapName);
        settingSearh(0, 0, INC.la("game_mode_csl"), types);



        GUILayout.EndScrollView();
    }