void BtnDeleteOnClick()
    {
        if (Input.GetMouseButtonUp(0))
        {
            //if(LockRoomList)
            //	return;

            if (mRoomListPage == 0 || mRoomListPage == 1)
            {
                if (mRoomList.mSelectedIndex > -1 && mRoomList.mSelectedIndex < _curServerList.Count)
                {
                    if (!GameClientLobby.role.name.Equals(_curServerList[mRoomList.mSelectedIndex].ServerMasterName))
                    {
                        return;
                    }

                    LobbyInterface.LobbyRPC(ELobbyMsgType.CloseServer, _curServerList[mRoomList.mSelectedIndex].ServerID, SteamMgr.steamId.m_SteamID);
                    MessageBox_N.ShowMaskBox(MsgInfoType.ServerDeleteMask, PELocalization.GetString(8000058), 15f);
                }
            }
            else if (mRoomListPage == 2)
            {
                if (roomUID != 0)
                {
                    mRecentRoom_M.DeleteItem(roomUID);
                }
            }
            roomUID = 0;
            RefreshRoomList();
            if (checkIndex != -1)
            {
                roomListChickItem(checkIndex);
            }
        }
    }
        /// <summary>
        /// Async CreateLobby
        /// </summary>
        /// <param name="lobby">LobbyInterface</param>
        /// <param name="localUserId">Login user id</param>
        /// <param name="maxLobbyMembers">Max member count</param>
        /// <param name="permissionLevel">Public settings, etc.</param>
        /// <returns>Task</returns>
        public static async UniTask <CreateLobbyCallbackInfo> CreateLobby(this LobbyInterface lobby, ProductUserId localUserId, uint maxLobbyMembers, LobbyPermissionLevel permissionLevel)
        {
            var lobbyOp = new CreateLobbyOptions
            {
                LocalUserId     = localUserId,
                MaxLobbyMembers = maxLobbyMembers,
                PermissionLevel = permissionLevel,
            };
            CreateLobbyCallbackInfo info = null;

            lobby.CreateLobby(lobbyOp, null, e =>
            {
                info = e;
            });
            while (info == null)
            {
                await UniTask.NextFrame();
            }

            if (info.ResultCode == Result.Success)
            {
                return(info);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{info.ResultCode}");
            return(null);
        }
        /// <summary>
        /// Async JoinLobby
        /// </summary>
        /// <param name="lobby">LobbyInterface</param>
        /// <param name="lobbyDetailsHandle">Lobby detail</param>
        /// <param name="localUserId">Login user id</param>
        /// <returns>Task</returns>
        public static async UniTask <JoinLobbyCallbackInfo> JoinLobby(this LobbyInterface lobby, LobbyDetails lobbyDetailsHandle, ProductUserId localUserId)
        {
            var joinOp = new JoinLobbyOptions
            {
                LobbyDetailsHandle = lobbyDetailsHandle,
                LocalUserId        = localUserId
            };
            JoinLobbyCallbackInfo info = null;

            lobby.JoinLobby(joinOp, null, e =>
            {
                info = e;
            });
            while (info == null)
            {
                await UniTask.NextFrame();
            }

            if (info.ResultCode == Result.Success)
            {
                return(info);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{info.ResultCode}");
            return(null);
        }
    void CreatePlayer()
    {
        string nickname = mNameInput.text;

        if (string.IsNullOrEmpty(nickname))
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000051));
            return;
        }

        int mSex = (int)Sex;

        if (Pathea.PeGameMgr.IsSingle)
        {
            CustomDataMgr.Instance.Current = CreateCustomData();
            CustomDataMgr.Instance.Current.charactorName = nickname;

            if (Pathea.PeGameMgr.sceneMode == Pathea.PeGameMgr.ESceneMode.Custom)
            {
                //				mUIMapSelect.SetActive(true);
                Pathea.PeGameMgr.playerType  = Pathea.PeGameMgr.EPlayerType.Single;
                Pathea.PeGameMgr.loadArchive = Pathea.ArchiveMgr.ESave.New;
                Pathea.PeGameMgr.sceneMode   = Pathea.PeGameMgr.ESceneMode.Custom;

                Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.GameScene);
            }

            else if (Pathea.PeGameMgr.randomMap)
            {
                SeedSetGui_N.Instance.Show();
            }
            else
            {
                IntroRunner.movieEnd = (() =>
                {
                    Debug.Log("<color=aqua>intro movie end.</color>");
                    PeSceneCtrl.Instance.GotoGameSence();
                });

                Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.Intro);
            }
        }
        else if (Pathea.PeGameMgr.IsMulti)
        {
            if (actionOk)
            {
                byte[] appearData = mCurrent.mAppearData.Serialize();
                byte[] nudeData   = mCurrent.mNude.Serialize();
                LobbyInterface.LobbyRPC(ELobbyMsgType.RoleCreate, nickname, (byte)(mSex), appearData, nudeData);
                actionOk = false;
                Invoke("ResetActionOK", 2.0f);
            }
        }
        else
        {
            Debug.LogError("error player mode.");
        }
    }
Beispiel #5
0
    public bool BuyItems(int id, int amount)
    {
        int price = LobbyShopMgr.GetPrice(id);

        if (price <= 0 || price * amount > (int)(AccountItems.self.balance))
        {
            return(false);
        }
        LobbyInterface.LobbyRPC(ELobbyMsgType.BuyItems, id, amount);
        return(true);
    }
 void OnRemoteStorageFilePublishResult(RemoteStoragePublishFileResult_t pCallback, bool bIOFailure)
 {
     if (pCallback.m_eResult == EResult.k_EResultOK)
     {
         _PublishedFileId = pCallback.m_nPublishedFileId;
         LobbyInterface.LobbyRPC(ELobbyMsgType.UploadISOSuccess, _hashCode, SteamMgr.steamId.m_SteamID);
     }
     if (EResult.k_EResultInsufficientPrivilege == pCallback.m_eResult)
     {
         MessageBox_N.ShowOkBox(PELocalization.GetString(8000491));
     }
     OnFilePublished();
 }
 public void Invite(ulong steamID, long serverUID)
 {
     foreach (var iter in _FriendsList)
     {
         if (iter.Value._SteamID.m_SteamID == steamID)
         {
             CSteamID steamId = SteamMgr.steamId;
             LobbyInterface.LobbyRPC(ELobbyMsgType.SteamInvite, steamId.m_SteamID, steamID, serverUID);
             if (iter.Value._PlayedGameName != "Planet Explorers")
             {
                 InviteToGame(steamID, serverUID);
             }
             break;
         }
     }
 }
        /// <summary>
        /// Short UpdateLobbyModification
        /// </summary>
        /// <param name="lobby">LobbyInterface</param>
        /// <param name="maxResults">Max search count</param>
        /// <returns>Lobby search instance</returns>
        public static LobbySearch CreateLobbySearch(this LobbyInterface lobby, uint maxResults)
        {
            var lobbyOp = new CreateLobbySearchOptions
            {
                MaxResults = maxResults
            };

            LobbySearch search;
            var         result = lobby.CreateLobbySearch(lobbyOp, out search);

            if (result == Result.Success)
            {
                return(search);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{result}");
            return(null);
        }
        /// <summary>
        /// <see cref="CopyAttributeByIndex" /> is used to immediately retrieve a copy of a lobby attribute from a given source such as a existing lobby or a search result.
        /// If the call returns an <see cref="Result.Success" /> result, the out parameter, OutAttribute, must be passed to <see cref="LobbyInterface.Release" /> to release the memory associated with it.
        /// <seealso cref="Attribute" />
        /// <seealso cref="LobbyDetailsCopyAttributeByIndexOptions" />
        /// <seealso cref="LobbyInterface.Release" />
        /// </summary>
        /// <param name="options">Structure containing the input parameters</param>
        /// <param name="outAttribute">Out parameter used to receive the <see cref="Attribute" /> structure.</param>
        /// <returns>
        /// <see cref="Result.Success" /> if the information is available and passed out in OutAttribute
        /// <see cref="Result.InvalidParameters" /> if you pass a null pointer for the out parameter
        /// <see cref="Result.IncompatibleVersion" /> if the API version passed in is incorrect
        /// </returns>
        public Result CopyAttributeByIndex(LobbyDetailsCopyAttributeByIndexOptions options, out Attribute outAttribute)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <LobbyDetailsCopyAttributeByIndexOptionsInternal, LobbyDetailsCopyAttributeByIndexOptions>(ref optionsAddress, options);

            var outAttributeAddress = System.IntPtr.Zero;

            var funcResult = EOS_LobbyDetails_CopyAttributeByIndex(InnerHandle, optionsAddress, ref outAttributeAddress);

            Helper.TryMarshalDispose(ref optionsAddress);

            if (Helper.TryMarshalGet <AttributeInternal, Attribute>(outAttributeAddress, out outAttribute))
            {
                LobbyInterface.EOS_Lobby_Attribute_Release(outAttributeAddress);
            }

            return(funcResult);
        }
    void SendMsg()
    {
        string chatStr = mMsgText.text;

        //lz-2016.12.12 发消息的时候加入语言识别,方便显示处理
        chatStr += SystemSettingData.Instance.IsChinese ? UITalkBoxCtrl.LANGE_CN : UITalkBoxCtrl.LANGE_OTHER;

        LobbyInterface.LobbyRPC(ELobbyMsgType.SendMsg,
                                EMsgType.ToAll,
                                GameClientLobby.role.steamId,
                                GameClientLobby.role.name,
                                chatStr);

        mMsgText.text = "";


        Invoke("GetInputFocus", 0.1f);
    }
        /// <summary>
        /// Short UpdateLobbyModification
        /// </summary>
        /// <param name="lobby">LobbyInterface</param>
        /// <param name="localUserId">Login user id</param>
        /// <param name="LobbyId">Lobby id</param>
        /// <returns>Handle</returns>
        public static LobbyModification UpdateLobbyModification(this LobbyInterface lobby, ProductUserId localUserId, string lobbyId)
        {
            var modOp = new UpdateLobbyModificationOptions
            {
                LocalUserId = localUserId,
                LobbyId     = lobbyId
            };

            LobbyModification handle;
            var result = lobby.UpdateLobbyModification(modOp, out handle);

            if (result == Result.Success)
            {
                return(handle);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{result}");
            return(null);
        }
Beispiel #12
0
 public void SetLobby(LobbyInterface lobby)
 {
     DrawableLobby = lobby;
 }
Beispiel #13
0
 public LobbyVisualizer(LobbyInterface lobby)
 {
     SetLobby(lobby);
 }
Beispiel #14
0
 void RequestTestLogin(ulong id)
 {
     LobbyInterface.LobbyRPC(ELobbyMsgType.TestLogin, id);
 }
Beispiel #15
0
    internal static void SendFile(SteamUploadEventHandler callBackSteamUploadResult, string name, string desc, byte[] preData, byte[] data, string[] tags, bool sendToServer = true, int id = -1, ulong fileId = 0, bool free = false)
    {
        ulong hash = CRC64.Compute(data);
        bool  ret  = false;

        try
        {
            if (string.IsNullOrEmpty(name))
            {
                VCEMsgBox.Show(VCEMsgBoxType.EXPORT_EMPTY_NAME);
                LogManager.Error("File name cannot be null.");
                return;
            }
            if (!SteamUser.BLoggedOn())
            {
                LogManager.Error("log back in steam...");
                return;
            }

            bool bPublish = !sendToServer;
            if (SteamRemoteStorage.FileExists(hash.ToString() + "_preview"))
            {            //file exist,don't publish it;
            }

            if (!SteamRemoteStorage.IsCloudEnabledForAccount())
            {
                throw new Exception("Account cloud disabled.");
            }

            if (!SteamRemoteStorage.IsCloudEnabledForApp())
            {
                throw new Exception("App cloud disabled.");
            }
            if (!bPublish)
            {
                SteamFileItem item = new SteamFileItem(callBackSteamUploadResult, name, desc, preData, data, hash, tags, bPublish, sendToServer, id, fileId, free);
                item.StartSend();
            }
            else
            {
                SendIsoCache iso = new SendIsoCache();
                iso.id           = id;
                iso.hash         = hash;
                iso.name         = name;
                iso.preData      = preData;
                iso.sendToServer = sendToServer;
                iso.tags         = tags;
                iso.data         = data;
                iso.desc         = desc;
                iso.callBackSteamUploadResult = callBackSteamUploadResult;
                iso.bPublish = bPublish;
                if (AddToIsoCache(iso))
                {
                    LobbyInterface.LobbyRPC(ELobbyMsgType.UploadISO, hash, SteamMgr.steamId.m_SteamID);
                }
                else
                {
                    return;
                }
            }

            VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK);
            ret = true;
        }
        catch (Exception e)
        {
            VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK_FAILED);
            Debug.LogWarning("workshop error :" + e.Message);
            ToolTipsMgr.ShowText(e.Message);
        }
        finally
        {
            if (!ret && callBackSteamUploadResult != null)
            {
                callBackSteamUploadResult(id, false, hash);
            }
        }
    }