Esempio n. 1
0
 void OnDetails(MyGuiControlButton button)
 {
     if (m_selectedItem == null)
     {
         if (m_activeDetail)
         {
             MyScreenManager.RemoveScreen(m_detailScreen);
         }
         return;
     }
     else if (m_activeDetail)
     {
         MyScreenManager.RemoveScreen(m_detailScreen);
     }
     else if (!m_activeDetail)
     {
         if ((m_selectedItem.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.LOCAL)
         {
             var path = Path.Combine(m_localBlueprintFolder, m_selectedItem.Text.ToString(), "bp.sbc");
             if (File.Exists(path))
             {
                 m_thumbnailImage.Visible = false;
                 m_detailScreen           = new MyGuiDetailScreenLocal(
                     callBack : delegate(MyGuiControlListbox.Item item)
                 {
                     if (item == null)
                     {
                         m_screenshotButton.Enabled = false;
                         m_detailsButton.Enabled    = false;
                         m_replaceButton.Enabled    = false;
                         m_deleteButton.Enabled     = false;
                     }
                     m_selectedItem = item;
                     m_activeDetail = false;
                     m_detailScreen = null;
                     if (m_task.IsComplete)
                     {
                         RefreshBlueprintList();
                     }
                 },
                     selectedItem: m_selectedItem,
                     parent: this,
                     thumbnailTexture: m_selectedImage.BackgroundTexture,
                     textScale: m_textScale
                     );
                 m_activeDetail = true;
                 MyScreenManager.InputToNonFocusedScreens = true;
                 MyScreenManager.AddScreen(m_detailScreen);
             }
             else
             {
                 MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                            buttonType: MyMessageBoxButtonsType.OK,
                                            styleEnum: MyMessageBoxStyleEnum.Error,
                                            messageCaption: new StringBuilder("Error"),
                                            messageText: new StringBuilder("Cannot find the blueprint file.")
                                            ));
             }
         }
         else if ((m_selectedItem.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.STEAM)
         {
             var path2 = Path.Combine(m_workshopBlueprintFolder, (m_selectedItem.UserData as MyBlueprintItemInfo).PublishedItemId.ToString() + m_workshopBlueprintSuffix);
             if (File.Exists(path2))
             {
                 m_thumbnailImage.Visible = false;
                 m_detailScreen           = new MyGuiDetailScreenSteam(
                     callBack : delegate(MyGuiControlListbox.Item item)
                 {
                     m_selectedItem = item;
                     m_activeDetail = false;
                     m_detailScreen = null;
                     if (m_task.IsComplete)
                     {
                         RefreshBlueprintList();
                     }
                 },
                     selectedItem: m_selectedItem,
                     parent: this,
                     thumbnailTexture: m_selectedImage.BackgroundTexture,
                     textScale: m_textScale
                     );
                 m_activeDetail = true;
                 MyScreenManager.InputToNonFocusedScreens = true;
                 MyScreenManager.AddScreen(m_detailScreen);
             }
             else
             {
                 MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                            buttonType: MyMessageBoxButtonsType.OK,
                                            styleEnum: MyMessageBoxStyleEnum.Error,
                                            messageCaption: new StringBuilder("Error"),
                                            messageText: new StringBuilder("Cannot find the blueprint file.")
                                            ));
             }
         }
     }
 }
 void OnDetails(MyGuiControlButton button)
 {
     if (m_selectedItem == null)
     {
         if (m_activeDetail)
         {
             MyScreenManager.RemoveScreen(m_detailScreen);
         }
         return;
     }
     else if (m_activeDetail)
     {
         MyScreenManager.RemoveScreen(m_detailScreen);
     }
     else if (!m_activeDetail)
     {
         if ((m_selectedItem.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.LOCAL)
         {
             var path = Path.Combine(m_localBlueprintFolder, m_selectedItem.Text.ToString());
             if (Directory.Exists(path))
             {
                 m_detailScreen = new MyGuiDetailScreenScriptLocal(
                     callBack : delegate(MyScriptItemInfo item)
                 {
                     if (item == null)
                     {
                         m_renameButton.Enabled  = false;
                         m_detailsButton.Enabled = false;
                         m_deleteButton.Enabled  = false;
                     }
                     m_activeDetail = false;
                     if (m_task.IsComplete)
                     {
                         RefreshBlueprintList(m_detailScreen.WasPublished);
                     }
                 },
                     selectedItem: (m_selectedItem.UserData  as MyScriptItemInfo),
                     parent: this,
                     textScale: m_textScale
                     );
                 m_activeDetail = true;
                 MyScreenManager.InputToNonFocusedScreens = true;
                 MyScreenManager.AddScreen(m_detailScreen);
             }
             else
             {
                 MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                            buttonType: MyMessageBoxButtonsType.OK,
                                            styleEnum: MyMessageBoxStyleEnum.Error,
                                            messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                            messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_ScriptNotFound)
                                            ));
             }
         }
         else if ((m_selectedItem.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.STEAM)
         {
             m_detailScreen = new MyGuiDetailScreenScriptLocal(
                 callBack : delegate(MyScriptItemInfo item)
             {
                 m_activeDetail = false;
                 if (m_task.IsComplete)
                 {
                     RefreshBlueprintList();
                 }
             },
                 selectedItem: (m_selectedItem.UserData as MyScriptItemInfo),
                 parent: this,
                 textScale: m_textScale
                 );
             m_activeDetail = true;
             MyScreenManager.InputToNonFocusedScreens = true;
             MyScreenManager.AddScreen(m_detailScreen);
         }
     }
 }