Example #1
0
        public void SendDeleteCraftMsg(CraftBasicEntry craft)
        {
            var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData <CraftLibraryDeleteRequestMsgData>();

            msgData.CraftToDelete.FolderName = craft.FolderName;
            msgData.CraftToDelete.CraftName  = craft.CraftName;
            msgData.CraftToDelete.CraftType  = craft.CraftType;

            SendMessage(msgData);
        }
        /// <summary>
        /// Request a craft to the server if possible
        /// </summary>
        public void RequestCraft(CraftBasicEntry craft)
        {
            if (TimeUtil.IsInInterval(ref _lastRequest, SettingsSystem.ServerSettings.MinCraftLibraryRequestIntervalMs))
            {
                MessageSender.SendRequestCraftMsg(craft);
            }
            else
            {
                var msg = LocalizationContainer.ScreenText.CraftLibraryInterval.Replace("$1",
                                                                                        TimeSpan.FromMilliseconds(SettingsSystem.ServerSettings.MinCraftLibraryRequestIntervalMs).TotalSeconds.ToString(CultureInfo.InvariantCulture));

                LunaScreenMsg.PostScreenMessage(msg, 20f, ScreenMessageStyle.UPPER_CENTER);
            }
        }
Example #3
0
 private static void HandleCraftList(CraftLibraryListReplyMsgData listMsg)
 {
     if (System.CraftInfo.TryGetValue(listMsg.FolderName, out var craftEntries))
     {
         for (var i = 0; i < listMsg.PlayerCraftsCount; i++)
         {
             var craftInfo = new CraftBasicEntry
             {
                 CraftName  = listMsg.PlayerCrafts[i].CraftName,
                 CraftType  = listMsg.PlayerCrafts[i].CraftType,
                 FolderName = listMsg.PlayerCrafts[i].FolderName
             };
             craftEntries.AddOrUpdate(listMsg.PlayerCrafts[i].CraftName, craftInfo, (key, existingVal) => craftInfo);
         }
     }
 }