private void listBox_Replace_DrawItem(object sender, DrawItemEventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            // Draw the background of the ListBox control for each item.
            e.DrawBackground();
            // Define the default color of the brush as black.
            Brush myBrush = Brushes.Black;

            //设定焦点
            Object folderObj = mapElement.mapsManager.antetypesManager[comboBox_folder.SelectedIndex];

            if (folderObj != null)
            {
                AntetypeFolder folder = (AntetypeFolder)folderObj;
                int            index  = listBox_Actors.SelectedIndex;
                if (index >= 0 && index < anteTypes_current.Count)
                {
                    if (anteTypes_replace[index] != null)
                    {
                        Antetype replaceAT = (Antetype)anteTypes_replace[index];
                        int      itemID    = replaceAT.GetID();
                        if (itemID >= 0 && e.Index == itemID)
                        {
                            myBrush = Brushes.Red;
                        }
                    }
                }
            }

            // Draw the current item text based on the current Font and the custom brush settings.
            e.Graphics.DrawString(listBox.Items[e.Index].ToString(), e.Font, myBrush, e.Bounds, StringFormat.GenericDefault);
            // If the ListBox has focus, draw a focus rectangle around the selected item.
            e.DrawFocusRectangle();
        }
        private void listBox_Actors_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (noEvent)
            {
                return;
            }
            int index = listBox_Actors.SelectedIndex;

            if (index < 0 || index >= anteTypes_current.Count || anteTypes_current[index] == null)
            {
                return;
            }
            if (anteTypes_replace[index] == null)
            {
                return;
            }
            Antetype       replaceAT = (Antetype)anteTypes_replace[index];
            AntetypeFolder folder    = replaceAT.getFolder();

            if (folder == null)
            {
                return;
            }
            noEvent = true;
            comboBox_folder.SelectedIndex = folder.GetID();
            refreshActorList();
            noEvent = false;
        }
Ejemplo n.º 3
0
        public Antetype clone(AntetypeFolder folder)
        {
            Antetype newInstance = new Antetype(folder, Actor);

            newInstance.name = name;
            for (int i = 0; i < imgMappingList.getElementCount(); i++)
            {
                ImageMappingElement imgMapElement    = (ImageMappingElement)imgMappingList.getElement(i);
                ImageMappingElement newImgMapElement = imgMapElement.clone();
                newInstance.imgMappingList.addElement(newImgMapElement);
            }
            return(newInstance);
        }
        private void refreshActorList()
        {
            if (mapElement == null)
            {
                return;
            }
            if (comboBox_folder.Items.Count <= 0)
            {
                return;
            }
            Object folderObj = mapElement.mapsManager.antetypesManager[comboBox_folder.SelectedIndex];

            if (folderObj == null)
            {
                return;
            }
            AntetypeFolder folder = (AntetypeFolder)folderObj;

            listBox_Replace.Items.Clear();
            for (int i = 0; i < folder.Count(); i++)
            {
                Antetype anteType = folder[i];
                listBox_Replace.Items.Add(anteType.name);
            }
            //设定焦点
            int index = listBox_Actors.SelectedIndex;

            if (index < 0 || index >= anteTypes_current.Count)
            {
                return;
            }
            if (anteTypes_replace[index] != null)
            {
                Antetype replaceAT = (Antetype)anteTypes_replace[index];
                int      itemID    = replaceAT.GetID();
                if (itemID >= 0)
                {
                    noEvent = true;
                    listBox_Replace.SelectedIndex = itemID;
                    noEvent = false;
                }
            }
        }
Ejemplo n.º 5
0
        public MParentNode GetTopParent()
        {
            MParentNode parent = GetParent();

            if (parent != null)
            {
                if (!(parent is MSonNode))
                {
                    Console.WriteLine("error");
                }
                while (((MSonNode)parent).GetParent() != null)
                {
                    parent = ((MSonNode)parent).GetParent();
                    if (!(parent is MSonNode))
                    {
                        Console.WriteLine("error");
                    }
                }
            }
            return(parent);
        }
        private void listBox_Replace_DoubleClick(object sender, EventArgs e)
        {
            if (noEvent)
            {
                return;
            }
            int index = listBox_Actors.SelectedIndex;

            if (index < 0 || index >= anteTypes_current.Count)
            {
                return;
            }
            AntetypeFolder folder = mapElement.mapsManager.antetypesManager[comboBox_folder.SelectedIndex];

            if (folder == null)
            {
                return;
            }
            anteTypes_replace[index] = folder[listBox_Replace.SelectedIndex];
            listBox_Replace.Refresh();
        }
        private void init()
        {
            needUpdate = false;
            if (mapElement == null)
            {
                return;
            }
            noEvent = true;
            //初始化角色原型文件夹
            comboBox_folder.Items.Clear();
            for (int i = 0; i < mapElement.mapsManager.antetypesManager.Count(); i++)
            {
                AntetypeFolder folder = mapElement.mapsManager.antetypesManager[i];
                comboBox_folder.Items.Add(folder.name);
            }
            //初始化当前角色原型列表
            anteTypes_current = mapElement.getAnteTypesUsed();
            MiscUtil.copyArrayList(anteTypes_current, anteTypes_replace);
            listBox_Actors.Items.Clear();
            Graphics g        = listBox_Actors.CreateGraphics();
            float    spaceLen = GraphicsUtil.getStringSizeF(g, "__________", listBox_Actors.Font).Width / 10.0F;

            for (int i = 0; i < anteTypes_current.Count; i++)
            {
                Antetype anteType = (Antetype)anteTypes_current[i];
                String   name     = anteType.name + "";
                String   usedTime = "[" + mapElement.getTileUsedTime(anteType) + "]";
                float    space    = 40 - GraphicsUtil.getStringSizeF(g, usedTime, listBox_Actors.Font).Width;
                for (int j = 0; j < space / spaceLen; j++)
                {
                    usedTime += " ";
                }
                listBox_Actors.Items.Add(usedTime + name);
            }
            g.Dispose();
            noEvent = false;
        }
Ejemplo n.º 8
0
 public void SetParent(MParentNode parent)
 {
     this.parent = (AntetypeFolder)parent;
 }
Ejemplo n.º 9
0
 public Antetype(AntetypeFolder parentT, MActor actorT)
 {
     parent = parentT;
     Actor  = actorT;
     name   = Actor.name + "";
 }
Ejemplo n.º 10
0
 public Antetype(AntetypeFolder parentT)
 {
     parent = parentT;
     name   = "未命名";
 }