Example #1
0
        void BehaviorKeyPanel_MouseEnter(object sender, EventArgs e)
        {
            ParticalsWin pw = ownerPanel as ParticalsWin;
            BehaviorWin  bw = ownerPanel as BehaviorWin;

            if (ModifierKeys == Keys.Control)
            {//((ParticalsWin)this.Parent.Parent.Parent)
                if (pw != null)
                {
                    pw.fToolTip.Active = true;
                }
                else if (bw != null)
                {
                    bw.fToolTip.Active = true;
                }
            }
            else
            {
                if (pw != null)
                {
                    pw.fToolTip.Active = false;
                }
                else if (bw != null)
                {
                    bw.fToolTip.Active = false;
                }
            }
        }
Example #2
0
        private void browserBtn_Click(object sender, EventArgs e)
        {
            string oldPath     = openFileDialog1.InitialDirectory;
            string oldFileName = openFileDialog1.FileName;

            if (System.IO.File.Exists(textureNamePath_txBx.Text))
            {
                openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName(textureNamePath_txBx.Text);
            }
            else if (textureNamePath_txBx.Tag != null && System.IO.File.Exists((string)textureNamePath_txBx.Tag))
            {
                openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName((string)textureNamePath_txBx.Tag);
            }
            else if (rootPath != null)
            {
                string root = rootPath;

                if (root.Contains("data\\"))
                {
                    root = root.Substring(0, root.IndexOf("data\\"));
                }

                openFileDialog1.InitialDirectory = root + @"src\texture_library";
            }

            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                textureNamePath_txBx.Tag = openFileDialog1.FileName;

                textureNamePath_txBx.Text = System.IO.Path.GetFileName(openFileDialog1.FileName);

                ParticalsWin pWin = (ParticalsWin)ownerPanel;

                if (pWin != null)
                {
                    string path = pWin.getTexturePath(textureNamePath_txBx.Text);

                    if (path == null)
                    {
                        pWin.addToTextureDic(openFileDialog1.FileName);
                    }
                }
            }

            if ((oldPath == null || oldPath.Trim().Length == 0) && oldFileName != null)
            {
                oldPath = System.IO.Path.GetDirectoryName(oldFileName);
            }

            openFileDialog1.InitialDirectory = oldPath;
        }
        private void load_btn_Click(object sender, System.EventArgs e)
        {
            if ((openFileDialog1.InitialDirectory == null ||
                 !openFileDialog1.InitialDirectory.ToLower().Contains(@"data\fx")) &&
                openFileDialog1.FileName != null &&
                openFileDialog1.FileName.ToLower().Contains(@"data\fx"))
            {
                openFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName);
            }

            else if (!openFileDialog1.InitialDirectory.ToLower().Contains(@"data\fx") && fxFile != null)
            {
                openFileDialog1.InitialDirectory = Path.GetDirectoryName(fxFile);
            }

            if (eventsBhvrFilesMComboBx.Text != null)
            {
                string currentFileName = eventsBhvrFilesMComboBx.Text;

                openFileDialog1.FileName = currentFileName;
            }

            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (ownerName.Equals("Behavior"))
                {
                    BehaviorWin bWin = (BehaviorWin)this.ownerDockablePanel;
                    bWin.loadStandAloneBhvrFile(openFileDialog1.FileName);
                    this.eventsComboBx.Enabled           = true;
                    this.eventsBhvrFilesMComboBx.Enabled = true;
                    this.saveAs_btn.Enabled = true;
                }
                else
                {
                    ParticalsWin pWin = (ParticalsWin)this.ownerDockablePanel;
                    pWin.loadStandAlonePartFile(openFileDialog1.FileName);
                }

                openFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName);

                eventsComboBx_SelectedIndexChanged(eventsComboBx, new System.EventArgs());

                if (eventsBhvrFilesMComboBx.Items.Count > 0)
                {
                    eventsBhvrFilesMComboBx.SelectedIndex = eventsBhvrFilesMComboBx.Items.Count - 1;
                }
            }
        }
        private void new_btn_Click(object sender, System.EventArgs e)
        {
            if (saveFileDialog1.InitialDirectory == null &&
                saveFileDialog1.FileName != null &&
                saveFileDialog1.FileName.ToLower().Contains(@"data\fx"))
            {
                saveFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName);
            }
            else if (saveFileDialog1.InitialDirectory == null &&
                     openFileDialog1.FileName != null &&
                     openFileDialog1.FileName.ToLower().Contains(@"data\fx"))
            {
                saveFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName);
            }
            if (!saveFileDialog1.InitialDirectory.ToLower().Contains(@"data\fx") && fxFile != null)
            {
                saveFileDialog1.InitialDirectory = Path.GetDirectoryName(fxFile);
            }

            if (eventsBhvrFilesMComboBx.Text != null)
            {
                string currentFileName = eventsBhvrFilesMComboBx.Text;

                saveFileDialog1.FileName = currentFileName;
            }

            DialogResult dr = saveFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (dr == DialogResult.OK)
                {
                    if (ownerName.Equals("Behavior"))
                    {
                        BehaviorWin bWin = (BehaviorWin)this.ownerDockablePanel;
                        bWin.setBhvrPanels(new Behavior("null.bhvr"));
                        common.COH_IO.writeDistFile(bWin.getData(), saveFileDialog1.FileName);
                        bWin.loadStandAloneBhvrFile(saveFileDialog1.FileName);
                    }
                    else
                    {
                        ParticalsWin pWin = (ParticalsWin)this.ownerDockablePanel;
                        pWin.setPartPanels(new Partical("null.part", false));
                        common.COH_IO.writeDistFile(pWin.getData(), saveFileDialog1.FileName);
                        pWin.loadStandAlonePartFile(saveFileDialog1.FileName);
                    }
                    enableElements(true);
                }
            }
        }
Example #5
0
        private void textureNamePath_txBx_TextChanged(object sender, EventArgs e)
        {
            if (rgb_picBx != null)
            {
                rgb_picBx.Image   = null;
                alpha_picBx.Image = null;
            }

            if (textureNamePath_txBx.Text.ToLower().EndsWith(".tga"))
            {
                string path = null;

                if (textureNamePath_txBx.Tag != null &&
                    ((string)textureNamePath_txBx.Tag).EndsWith(textureNamePath_txBx.Text))
                {
                    path = (string)textureNamePath_txBx.Tag;
                }
                else
                {
                    ParticalsWin pWin = (ParticalsWin)ownerPanel;

                    if (pWin != null)
                    {
                        path = pWin.getTexturePath(textureNamePath_txBx.Text);

                        textureNamePath_txBx.Tag = path;

                        if (path == null)
                        {
                            pWin.addToTextureDic(openFileDialog1.FileName);
                        }
                    }
                }

                if (rgb_picBx != null && path != null)
                {
                    setIconImage(path);
                }
            }

            base.keyVal_numericUpDown_ValueChanged(sender, e);
        }
        private void setStatus()
        {
            if (ownerName.Equals("Behavior"))
            {
                BehaviorWin bWin = (BehaviorWin)ownerDockablePanel;

                Behavior bhvr = (Behavior)(bWin).BhvrTag;

                bhvr.refreshP4ROAttributes();

                save_btn.Enabled = !bhvr.isReadOnly;

                bool lockCtl = bhvr.isReadOnly;

                if (Path.GetFileName(bhvr.fileName).ToLower().Equals("null.bhvr"))
                {
                    lockCtl = false;
                }


                bWin.enable(!lockCtl);

                bWin.isLocked = lockCtl;
            }
            else
            {
                ParticalsWin pWin = (ParticalsWin)ownerDockablePanel;

                Partical part = (Partical)(pWin).Tag;

                part.refreshP4ROAttributes();

                save_btn.Enabled = !part.isReadOnly;

                pWin.enable(!part.isReadOnly);

                pWin.isLocked = part.isReadOnly;
            }

            eventsBhvrFilesMComboBx_SelectedIndexChanged(eventsBhvrFilesMComboBx, new EventArgs());
        }
        private void updatePart(string fileName, ArrayList data)
        {
            Partical part = ParticalParser.parse(fileName, ref data);

            ParticalsWin pWin = (ParticalsWin)ownerDockablePanel;

            foreach (KeyValuePair <string, object> kvp in part.pParameters)
            {
                pWin.Tag.pParameters[kvp.Key] = kvp.Value;
            }

            pWin.Tag.fileName = part.fileName;

            pWin.Tag.isCommented = part.isCommented;

            pWin.Tag.isDirty = part.isDirty;

            pWin.Tag.isP4 = part.isP4;

            pWin.Tag.isReadOnly = part.isReadOnly;

            ((ParticalsWin)ownerDockablePanel).setIsDirty(false);
        }
        private void saveFile(string file_name)
        {
            if (ownerName.Equals("Behavior"))
            {
                BehaviorWin bWin = (BehaviorWin)this.ownerDockablePanel;

                ArrayList data = bWin.getData();

                common.COH_IO.writeDistFile(data, file_name);

                //updateBhvr(file_name, data);
            }
            else
            {
                ParticalsWin pWin = (ParticalsWin)this.ownerDockablePanel;

                ArrayList data = pWin.getData();

                common.COH_IO.writeDistFile(data, file_name);

                //updatePart(file_name, data);
            }
        }