示例#1
0
        public int GetTotalItemsQueuedStorageUsedByRoomDesign(RoomDesign roomDesign)
        {
            int num = 0;

            for (int index1 = 0; index1 < this.Rooms.Length; ++index1)
            {
                PSMainRoom room = this.Rooms[index1] as PSMainRoom;
                if (room.RoomStatus != RoomStatus.Inventory && room.RoomStatus != RoomStatus.Inventory && (room.RoomDesign.ItemRank == roomDesign.ItemRank && room.RoomDesign.ManufactureType == roomDesign.ManufactureType) && room.ManufactureString != string.Empty)
                {
                    List <PSResourceGroup> psResourceGroupList = new List <PSResourceGroup>();
                    for (int index2 = 0; index2 < room.ManufactureItemQueue.Count; ++index2)
                    {
                        PSResourceGroup manufactureItem = room.ManufactureItemQueue[index2];
                        if (!psResourceGroupList.Contains(manufactureItem))
                        {
                            psResourceGroupList.Add(manufactureItem);
                        }
                    }
                    for (int index2 = 0; index2 < psResourceGroupList.Count; ++index2)
                    {
                        PSResourceGroup psResourceGroup = psResourceGroupList[index2];
                        ItemDesign      itemDesignById  = SingletonManager <ItemManager> .Instance.GetItemDesignByID(psResourceGroup.resourceId);

                        num += itemDesignById.ItemSpace * psResourceGroup.quantity;
                    }
                }
            }
            return(num);
        }
示例#2
0
        private static void ServerMessageReceived(PSMessage psMessage, bool isPusher)
        {
            if (!isPusher)
            {
                return;
            }
            if (psMessage.ActivityType == ActivityType.MembershipChanged && isPusher)
            {
                if (SingletonManager <UserManager> .Instance.user.Id == psMessage.ToUserId)
                {
                    Debug.LogWarning((object)"Membership Changed", (Object)null);
                    SingletonManager <UserManager> .Instance.user.AllianceMembership = AllianceManager.MembershipStringToEnum(psMessage.ActivityArgument);
                }
                if (SingletonManager <UserManager> .Instance.user.AllianceMembership == AllianceMembership.None)
                {
                    Debug.LogWarning((object)"Membership Reset", (Object)null);
                    SingletonManager <AllianceManager> .Instance.ResetCurrentAlliance();
                }
            }
            if (psMessage.ActivityType == ActivityType.DeviceLogin && !psMessage.ActivityArgument.Equals(UserManager.Md5Sum(SingletonManager <UserManager> .Instance.deviceKey)))
            {
                AlertController.ShowDisconnectPanel(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Disconnected"), psMessage.MessageString, SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Reload"));
            }
            if (psMessage.ActivityType != ActivityType.ModelUpdate || string.IsNullOrEmpty(psMessage.ActivityArgument))
            {
                return;
            }
            PSMainRoom room = SingletonManager <RoomManager> .Instance.ParseRoom <PSMainRoom>(Regex.Unescape(psMessage.ActivityArgument));

            SingletonManager <ShipManager> .Instance.PlayerShip.GetRoomByRoomId(room.RoomId).ConstructionStartDate = room.ConstructionStartDate;
        }