Exemple #1
0
 public void Clear()
 {
     is_loading = true;
     scripts.Clear();
     list.Children.Clear();
     current_page = null;
     is_loading   = false;
 }
Exemple #2
0
        //-----------------------------

        private void page_OnScriptLoaded(ScriptPageControl page)
        {
            if (page == current_page)
            {
                lstLanguage.SelectedIndex = (page.Script.IsDecompiled ? 1 : 0);
                lstItems.ItemsSource      = page.Items;
                lstItems.IsEnabled        = (page.Items.Count > 0);
            }
        }
Exemple #3
0
        //-----------------------------

        private ScriptPageControl addTab(string name)
        {
            ScriptPageControl page = new ScriptPageControl();

            page.OnScriptLoaded += page_OnScriptLoaded;
            page.ScriptMgr       = ScriptMgr;
            page.Load(name);
            list.Children.Add(page);
            scripts.Insert(0, page.Script);
            return(page);
        }
Exemple #4
0
        //=============================

        private void setPage(ScriptItem script)
        {
            bool is_page;

            foreach (ScriptPageControl c in list.Children)
            {
                is_page      = (c.Script == script);
                c.Visibility = (is_page ? Visibility.Visible : Visibility.Collapsed);
                if (is_page)
                {
                    current_page         = c;
                    lstItems.ItemsSource = c.Items;
                    lstItems.IsEnabled   = (c.Items.Count > 0);
                }
            }
        }
Exemple #5
0
        public void Load(NpcData data)
        {
            Clear();
            if (data == null)
            {
                HasChanges = false;
                return;
            }
            //
            string         var_ai = data.GetValue(NpcData.VAR_NPC_AI, null);
            ScriptProperty prop   = ScriptProperty.FromString(var_ai);
            string         name   = prop.ScriptName;

            //
            if (!string.IsNullOrEmpty(name))
            {
                ScriptPageControl page, first_page;
                first_page = page = addTab(name);
                //
                string current, super;
                bool   has_super;
                current = name;
                do
                {
                    super     = page.GetSuper();
                    has_super = (!string.IsNullOrEmpty(super) && super != current && super != "(null)");
                    if (has_super)
                    {
                        page = addTab(super);
                    }
                }while (page != null && has_super);
                //
                is_loading             = true;
                current_page           = first_page;
                lstScript.SelectedItem = first_page.Script;
                setPage(first_page.Script);
                is_loading = false;
            }
            //
            HasChanges = false;
        }