Inheritance: ALFA.Shared.IBackgroundLoadedResource, IDisposable
Ejemplo n.º 1
0
 public static void WaitForNavigator(CLRScriptBase script, Navigator nav)
 {
     if (nav.WaitForResourcesLoaded(false) == true)
     {
         DrawNavigatorCategory(script, nav.bottomCategory);
         return;
     }
     else
     {
         script.SendMessageToPC(script.OBJECT_SELF, "loading...");
         script.DelayCommand(0.5f, delegate() { WaitForNavigator(script, nav); });
         return;
     }
 }
        public static void LoadNavigator(List<ALFA.Shared.IListBoxItem> list, Navigator bottomNavigator)
        {
            try
            {
                foreach (ALFA.Shared.IListBoxItem boxItem in list)
                {
                    try
                    {
                        NavigatorCategory cat = null;
                        // first, find out if there even is a classification for this.
                        if (String.IsNullOrWhiteSpace(boxItem.Classification))
                        {
                            cat = bottomNavigator.bottomCategory;
                        }
                        // next, we want to find out if we're in one classification or in many.
                        else if (boxItem.Classification.Contains('|'))
                        {
                            string[] cats = boxItem.Classification.Split('|');
                            NavigatorCategory tempCat = bottomNavigator.bottomCategory;

                            foreach (string category in cats)
                            {
                                tempCat = GetCategoryByName(tempCat, category);
                            }
                            cat = tempCat;
                        }
                        // Looks like it's only one classification deep. Don't need to do anything fancy.
                        else
                        {
                            cat = GetCategoryByName(bottomNavigator.bottomCategory, boxItem.Classification);
                        }

                        cat.ContainedItems.Add(boxItem);
                    }
                    catch (Exception ex)
                    {
                        loaderError += "\n Placeable Loading Error: " + ex.Message;
                    }
                }
            }
            finally
            {
                bottomNavigator.SetResourcesLoaded();
            }
        }