public override void Update()
 {
     m_rateButton.IsEnabled = (m_starRating.Rating != 0f);
     if (m_rateButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
         CancellableBusyDialog busyDialog = new CancellableBusyDialog("иб╦═к└иоол...", autoHideOnCancel: false);
         DialogsManager.ShowDialog(base.ParentWidget, busyDialog);
         CommunityContentManager.Rate(m_address, m_userId, (int)m_starRating.Rating, busyDialog.Progress, delegate
         {
             DialogsManager.HideDialog(busyDialog);
         }, delegate
         {
             DialogsManager.HideDialog(busyDialog);
         });
     }
     if (m_reportLink.IsClicked && UserManager.ActiveUser != null)
     {
         DialogsManager.HideDialog(this);
         DialogsManager.ShowDialog(base.ParentWidget, new ReportCommunityContentDialog(m_address, m_displayName, UserManager.ActiveUser.UniqueId));
     }
     if (base.Input.Cancel || m_cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
 }
示例#2
0
        public void PopulateList(string cursor)
        {
            string text = string.Empty;

            if (SettingsManager.CommunityContentMode == CommunityContentMode.Strict)
            {
                text = "1";
            }
            if (SettingsManager.CommunityContentMode == CommunityContentMode.Normal)
            {
                text = "0";
            }
            string text2    = (m_filter is string) ? ((string)m_filter) : string.Empty;
            string text3    = (m_filter is ExternalContentType) ? LanguageControl.Get(fName, m_filter.ToString()) : string.Empty;
            string text4    = LanguageControl.Get(fName, m_order.ToString());
            string cacheKey = text2 + "\n" + text3 + "\n" + text4 + "\n" + text;

            m_moreLink = null;
            if (string.IsNullOrEmpty(cursor))
            {
                m_listPanel.ClearItems();
                m_listPanel.ScrollPosition = 0f;
                if (m_contentExpiryTime != 0.0 && Time.RealTime < m_contentExpiryTime && m_itemsCache.TryGetValue(cacheKey, out IEnumerable <object> value))
                {
                    foreach (object item in value)
                    {
                        m_listPanel.AddItem(item);
                    }
                    return;
                }
            }
            CancellableBusyDialog busyDialog = new CancellableBusyDialog(LanguageControl.Get(fName, 2), autoHideOnCancel: false);

            DialogsManager.ShowDialog(null, busyDialog);
            CommunityContentManager.List(cursor, text2, text3, text, text4, busyDialog.Progress, delegate(List <CommunityContentEntry> list, string nextCursor)
            {
                DialogsManager.HideDialog(busyDialog);
                m_contentExpiryTime = Time.RealTime + 300.0;
                while (m_listPanel.Items.Count > 0 && !(m_listPanel.Items[m_listPanel.Items.Count - 1] is CommunityContentEntry))
                {
                    m_listPanel.RemoveItemAt(m_listPanel.Items.Count - 1);
                }
                foreach (CommunityContentEntry item2 in list)
                {
                    m_listPanel.AddItem(item2);
                }
                if (list.Count > 0 && !string.IsNullOrEmpty(nextCursor))
                {
                    m_listPanel.AddItem(nextCursor);
                }
                m_itemsCache[cacheKey] = new List <object>(m_listPanel.Items);
            }, delegate(Exception error)
            {
                DialogsManager.HideDialog(busyDialog);
                DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null));
            });
        }
示例#3
0
        public IEnumerable <ActiveExternalContentInfo> GetActiveExternalContent()
        {
            string downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.World, DirectoryName);

            if (!string.IsNullOrEmpty(downloadedContentAddress))
            {
                yield return(new ActiveExternalContentInfo
                {
                    Address = downloadedContentAddress,
                    DisplayName = WorldSettings.Name,
                    Type = ExternalContentType.World
                });
            }
            if (!BlocksTexturesManager.IsBuiltIn(WorldSettings.BlocksTextureName))
            {
                downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.BlocksTexture, WorldSettings.BlocksTextureName);
                if (!string.IsNullOrEmpty(downloadedContentAddress))
                {
                    yield return(new ActiveExternalContentInfo
                    {
                        Address = downloadedContentAddress,
                        DisplayName = BlocksTexturesManager.GetDisplayName(WorldSettings.BlocksTextureName),
                        Type = ExternalContentType.BlocksTexture
                    });
                }
            }
            SubsystemPlayers subsystemPlayers = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);

            foreach (PlayerData playersDatum in subsystemPlayers.PlayersData)
            {
                if (!CharacterSkinsManager.IsBuiltIn(playersDatum.CharacterSkinName))
                {
                    downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.CharacterSkin, playersDatum.CharacterSkinName);
                    yield return(new ActiveExternalContentInfo
                    {
                        Address = downloadedContentAddress,
                        DisplayName = CharacterSkinsManager.GetDisplayName(playersDatum.CharacterSkinName),
                        Type = ExternalContentType.CharacterSkin
                    });
                }
            }
            SubsystemFurnitureBlockBehavior subsystemFurnitureBlockBehavior = base.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true);

            foreach (FurnitureSet furnitureSet in subsystemFurnitureBlockBehavior.FurnitureSets)
            {
                if (furnitureSet.ImportedFrom != null)
                {
                    downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.FurniturePack, furnitureSet.ImportedFrom);
                    yield return(new ActiveExternalContentInfo
                    {
                        Address = downloadedContentAddress,
                        DisplayName = FurniturePacksManager.GetDisplayName(furnitureSet.ImportedFrom),
                        Type = ExternalContentType.FurniturePack
                    });
                }
            }
        }
示例#4
0
 public IEnumerable <ActiveExternalContentInfo> GetRateableItems()
 {
     if (GameManager.Project != null && UserManager.ActiveUser != null)
     {
         SubsystemGameInfo subsystemGameInfo = GameManager.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
         foreach (ActiveExternalContentInfo item in subsystemGameInfo.GetActiveExternalContent())
         {
             if (!CommunityContentManager.IsContentRated(item.Address, UserManager.ActiveUser.UniqueId))
             {
                 yield return(item);
             }
         }
     }
 }
示例#5
0
        public void DownloadEntry(CommunityContentEntry entry)
        {
            string userId = (UserManager.ActiveUser != null) ? UserManager.ActiveUser.UniqueId : string.Empty;
            CancellableBusyDialog busyDialog = new CancellableBusyDialog(string.Format(LanguageControl.Get(fName, 1), entry.Name), autoHideOnCancel: false);

            DialogsManager.ShowDialog(null, busyDialog);
            CommunityContentManager.Download(entry.Address, entry.Name, entry.Type, userId, busyDialog.Progress, delegate
            {
                DialogsManager.HideDialog(busyDialog);
            }, delegate(Exception error)
            {
                DialogsManager.HideDialog(busyDialog);
                DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null));
            });
        }
示例#6
0
 public void Update(float dt)
 {
     TotalElapsedGameTime      += dt;
     TotalElapsedGameTimeDelta  = (m_lastTotalElapsedGameTime.HasValue ? ((float)(TotalElapsedGameTime - m_lastTotalElapsedGameTime.Value)) : 0f);
     m_lastTotalElapsedGameTime = TotalElapsedGameTime;
     if (m_subsystemTime.GameTime >= 600.0 && m_subsystemTime.GameTime - (double)m_subsystemTime.GameTimeDelta < 600.0 && UserManager.ActiveUser != null)
     {
         foreach (ActiveExternalContentInfo item in GetActiveExternalContent())
         {
             CommunityContentManager.SendPlayTime(item.Address, UserManager.ActiveUser.UniqueId, m_subsystemTime.GameTime, null, delegate
             {
             }, delegate
             {
             });
         }
     }
 }
        public LoadingScreen()
        {
            WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/LoadingScreen"));

            LabelWidget ExternalAssemblyInfo = new LabelWidget();

            ExternalAssemblyInfo.Text = "Powered By GScience Studio\n";
            //下列两行代码请勿随意删除
            ExternalAssemblyInfo.Text += "Author:" + Info.author + "\n";
            ExternalAssemblyInfo.Text += "Version:" + Info.version;

            ExternalAssemblyInfo.Color     = Color.LightBlue;
            ExternalAssemblyInfo.FontScale = 0.5f;
            this.ScreenWidget.Children.Add(ExternalAssemblyInfo);

            this.AddLoadAction((Action)(() => CommunityContentManager.Initialize()));
            this.AddLoadAction((Action)(() => MotdManager.Initialize()));
            this.AddLoadAction((Action)(() => LightingManager.Initialize()));
            this.AddLoadAction((Action)(() => StringsManager.LoadStrings()));
            this.AddLoadAction((Action)(() => TextureAtlasManager.LoadAtlases()));
            ReadOnlyList <ContentInfo> readOnlyList = ContentManager.List();

            // ISSUE: explicit reference operation
            using (ReadOnlyList <ContentInfo> .Enumerator enumerator = ((ReadOnlyList <ContentInfo>)@readOnlyList).GetEnumerator())
            {
                // ISSUE: explicit reference operation
                while (((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).MoveNext())
                {
                    // ISSUE: explicit reference operation
                    ContentInfo localContentInfo = ((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).Current;
                    this.AddLoadAction((Action)(() => ContentManager.Get((string)localContentInfo.Name)));
                }
            }
            this.AddLoadAction((Action)(() => DatabaseManager.LoadDatabase()));
            this.AddLoadAction((Action)(() => WorldsManager.Initialize()));
            this.AddLoadAction((Action)(() => BlocksTexturesManager.Initialize()));
            this.AddLoadAction((Action)(() => CharacterSkinsManager.Initialize()));
            this.AddLoadAction((Action)(() => FurniturePacksManager.Initialize()));
            this.AddLoadAction((Action)(() => BlocksManager.Initialize()));
            this.AddLoadAction((Action)(() => CraftingRecipesManager.Initialize()));
            this.AddLoadAction((Action)(() => GScienceStudio.InputManager.Initialize()));
        }
示例#8
0
 public void DeleteEntry(CommunityContentEntry entry)
 {
     if (UserManager.ActiveUser != null)
     {
         DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 4), LanguageControl.Get(fName, 5), LanguageControl.Get("Usual", "yes"), LanguageControl.Get("Usual", "no"), delegate(MessageDialogButton button)
         {
             if (button == MessageDialogButton.Button1)
             {
                 CancellableBusyDialog busyDialog = new CancellableBusyDialog(string.Format(LanguageControl.Get(fName, 3), entry.Name), autoHideOnCancel: false);
                 DialogsManager.ShowDialog(null, busyDialog);
                 CommunityContentManager.Delete(entry.Address, UserManager.ActiveUser.UniqueId, busyDialog.Progress, delegate
                 {
                     DialogsManager.HideDialog(busyDialog);
                     DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 6), LanguageControl.Get(fName, 7), LanguageControl.Get("Usual", "ok"), null, null));
                 }, delegate(Exception error)
                 {
                     DialogsManager.HideDialog(busyDialog);
                     DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null));
                 });
             }
         }));
     }
 }
示例#9
0
        public override void Update()
        {
            string text  = m_linkTextBoxWidget.Text.Trim();
            string text2 = m_nameTextBoxWidget.Text.Trim();

            m_typeLabelWidget.Text          = ExternalContentManager.GetEntryTypeDescription(m_type);
            m_typeIconWidget.Subtexture     = ExternalContentManager.GetEntryTypeIcon(m_type);
            m_publishButtonWidget.IsEnabled = (text.Length > 0 && text2.Length > 0);
            if (m_changeTypeButtonWidget.IsClicked)
            {
                DialogsManager.ShowDialog(base.ParentWidget, new SelectExternalContentTypeDialog("Select Content Type", delegate(ExternalContentType item)
                {
                    m_type = item;
                }));
            }
            else if (base.Input.Cancel || m_cancelButtonWidget.IsClicked)
            {
                DialogsManager.HideDialog(this);
            }
            else if (m_publishButtonWidget.IsClicked)
            {
                CancellableBusyDialog busyDialog = new CancellableBusyDialog("Publishing", autoHideOnCancel: false);
                DialogsManager.ShowDialog(base.ParentWidget, busyDialog);
                CommunityContentManager.Publish(text, text2, m_type, m_user, busyDialog.Progress, delegate
                {
                    DialogsManager.HideDialog(busyDialog);
                    DialogsManager.ShowDialog(base.ParentWidget, new MessageDialog("Link Published Successfully", "It should start appearing in the listings after it is moderated. Please keep the file accessible through this link, so that other community members can download it.", LanguageControl.Get("Usual", "ok"), null, delegate
                    {
                        DialogsManager.HideDialog(this);
                    }));
                }, delegate(Exception error)
                {
                    DialogsManager.HideDialog(busyDialog);
                    DialogsManager.ShowDialog(base.ParentWidget, new MessageDialog("Error", error.Message, LanguageControl.Get("Usual", "ok"), null, null));
                });
            }
        }
 public override void Update()
 {
     m_reportButton.IsEnabled = (m_reasonWidgetsList.Count((CheckboxWidget w) => w.IsChecked) == 1);
     if (m_reportButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
         DialogsManager.ShowDialog(base.ParentWidget, new MessageDialog("Are you sure?", "Reporting offensive content is a serious matter. Please make sure you checked the right box. Do not report content which is not offensive.", "Proceed", "Cancel", delegate(MessageDialogButton b)
         {
             if (b == MessageDialogButton.Button1)
             {
                 string report = string.Empty;
                 foreach (CheckboxWidget reasonWidgets in m_reasonWidgetsList)
                 {
                     if (reasonWidgets.IsChecked)
                     {
                         report = (string)reasonWidgets.Tag;
                         break;
                     }
                 }
                 CancellableBusyDialog busyDialog = new CancellableBusyDialog("Sending Report", autoHideOnCancel: false);
                 DialogsManager.ShowDialog(base.ParentWidget, busyDialog);
                 CommunityContentManager.Report(m_address, m_userId, report, busyDialog.Progress, delegate
                 {
                     DialogsManager.HideDialog(busyDialog);
                 }, delegate
                 {
                     DialogsManager.HideDialog(busyDialog);
                 });
             }
         }));
     }
     if (base.Input.Cancel || m_cancelButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
     }
 }
示例#11
0
        public LoadingScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/LoadingScreen");

            LoadContents(this, node);
            AddLoadAction(delegate
            {
                VrManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CommunityContentManager.Initialize();
            });
            AddLoadAction(delegate
            {
                MotdManager.Initialize();
            });
            AddLoadAction(delegate
            {
                LightingManager.Initialize();
            });
            AddLoadAction(delegate
            {
                StringsManager.LoadStrings();
            });
            AddLoadAction(delegate
            {
                TextureAtlasManager.LoadAtlases();
            });
            foreach (ContentInfo item in ContentManager.List())
            {
                ContentInfo localContentInfo = item;
                AddLoadAction(delegate
                {
                    ContentManager.Get(localContentInfo.Name);
                });
            }
            AddLoadAction(delegate
            {
                DatabaseManager.Initialize();
            });
            AddLoadAction(delegate
            {
                WorldsManager.Initialize();
            });
            AddLoadAction(delegate
            {
                BlocksTexturesManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CharacterSkinsManager.Initialize();
            });
            AddLoadAction(delegate
            {
                FurniturePacksManager.Initialize();
            });
            AddLoadAction(delegate
            {
                BlocksManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CraftingRecipesManager.Initialize();
            });
            AddLoadAction(delegate
            {
                MusicManager.CurrentMix = MusicManager.Mix.Menu;
            });
        }