示例#1
0
        private void InternalGetReferenceLists(out Dictionary <long, InternalClientItem> allSteamList, out Dictionary <long, InternalIdentityItem> allPlayerList)
        {
            if (MyAPIGateway.Players == null)
            {
                allSteamList  = new Dictionary <long, InternalClientItem>();
                allPlayerList = new Dictionary <long, InternalIdentityItem>();
                return;
            }

            /*
             * List<IMyPlayer> players = new List<IMyPlayer>();
             * List<IMyIdentity> identities = new List<IMyIdentity>();
             * //			SandboxGameAssemblyWrapper.Instance.GameAction(() =>
             * //			{
             *      MyAPIGateway.Players.GetPlayers(players);
             *      MyAPIGateway.Players.GetAllIdentites(identities);
             * //			});
             *
             * allSteamList = new Dictionary<long, InternalClientItem>();
             * foreach (IMyPlayer player in players)
             * {
             *      InternalClientItem item = new InternalClientItem(player);
             *      allSteamList.Add(player.PlayerID, item);
             * }
             *
             * allPlayerList = new Dictionary<long, InternalIdentityItem>();
             * foreach (IMyIdentity identity in identities)
             * {
             *      InternalIdentityItem item = new InternalIdentityItem(identity);
             *      allPlayerList.Add(identity.PlayerId, item);
             * }
             */
            Dictionary <object, long> steamList = InternalGetSteamIdMapping();

            allSteamList = new Dictionary <long, InternalClientItem>();
            foreach (KeyValuePair <object, long> p in steamList)
            {
                InternalClientItem item = new InternalClientItem(p.Key);
                allSteamList.Add(p.Value, item);
            }

            Dictionary <long, Object> playerList = InternalGetPlayerItemMapping();

            allPlayerList = new Dictionary <long, InternalIdentityItem>();
            foreach (KeyValuePair <long, object> p in playerList)
            {
                InternalIdentityItem item = new InternalIdentityItem(p.Value);
                allPlayerList.Add(p.Key, item);
            }
        }
示例#2
0
        private void InternalGetReferenceLists(out Dictionary <long, InternalClientItem> allSteamList, out Dictionary <long, InternalIdentityItem> allPlayerList)
        {
            Dictionary <object, long> steamList = InternalGetSteamIdMapping();

            allSteamList = new Dictionary <long, InternalClientItem>();
            foreach (KeyValuePair <object, long> p in steamList)
            {
                InternalClientItem item = new InternalClientItem(p.Key);
                allSteamList.Add(p.Value, item);
            }

            Dictionary <long, Object> playerList = InternalGetPlayerItemMapping();

            allPlayerList = new Dictionary <long, InternalIdentityItem>();
            foreach (KeyValuePair <long, object> p in playerList)
            {
                InternalIdentityItem item = new InternalIdentityItem(p.Value);
                allPlayerList.Add(p.Key, item);
            }
        }