Exemplo n.º 1
0
        protected void updateValue(Object value)
        {
            string text = value.ToString();

            ClassPropertyInfo cp = godzObject.getPropertyValue(propertyNameHash);

            if (cp.mPropertyType == GodzGlue.ClassPropertyType.PropertyType_HashCode)
            {
                //deref the old string then addref for the new String in the HashTable...
                //1. Find the old hash in the HashTable....
                if (cp.mObjectHash > 0)
                {
                    Editor.RemoveHash(cp.mObjectHash);
                }

                //2. Add the new String to the HashTable
                uint hash = GodzGlue.GodzUtil.GetHashCode(text);
                Editor.AddHash(hash, text, false);
            }

            godzObject.setProperty(propertyNameHash, text);
            DatabaseObjectInfo info = DatabaseObjectRegistry.get(godzObject);

            if (info != null)
            {
                info.modified = true;
            }
        }
Exemplo n.º 2
0
        private void lockForEditingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TabPanelData       data = mMainForm.getTabPanel();
            DatabaseObjectInfo inf  = DatabaseObjectRegistry.get(data.mSelectedEntity);

            if (inf.locked)
            {
                //they trying to checkin changes...
                submitChanges();

                if (Editor.UnlockEntity(data.mSelectedEntity))
                {
                    propertyGrid1.Enabled = false;
                }
            }
            else
            {
                //grab latest from the server then lock it
                Editor.RefreshEntity(data.mSelectedEntity, data.mActiveLayer.getName());
                if (Editor.LockEntity(data.mSelectedEntity))
                {
                    propertyGrid1.Enabled = true;
                }
            }
        }
Exemplo n.º 3
0
        public ObjectBase newInstance(Package p)
        {
            ClassBase godzClass = ClassBase.findClass(classhash);

            if (godzClass != null)
            {
                //set package
                ObjectBase obj = godzClass.newInstance();

                if (p != null)
                {
                    obj.setPackage(p);

                    DatabaseObjectInfo info = new DatabaseObjectInfo();
                    info.dbUser   = dbUser;
                    info.locked   = locked;
                    info.objID    = objID;
                    info.revision = revision;
                    DatabaseObjectRegistry.Items[obj] = info;

                    obj.Id = objID;

                    Editor.ImportXMLData(obj, xmlData);
                    Editor.ImportObjectReferences(obj, p);

                    return(obj);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        private void submitChanges()
        {
            TabPanelData       data = mMainForm.getTabPanel();
            DatabaseObjectInfo inf  = DatabaseObjectRegistry.get(data.mSelectedEntity);

            if (inf.locked)
            {
                //Update the database entry for this item
                Editor.UpdateEntity(data.mSelectedEntity.getLayer().getName(), data.mSelectedEntity);

                //remove from the modified actors list
                modifiedActorList.Remove(data.mSelectedEntity);
            }
            else
            {
                MessageBox.Show("Changes cannot be submitted for an unlocked object");
            }
        }
Exemplo n.º 5
0
        private void selectEntity(GodzGlue.Entity ent, TabPanelData data)
        {
            data.mSelectedEntity = ent;
            Object proxyObj = Editor.GetNewObjectProxy(ent);

            propertyGrid1.SelectedObject = proxyObj;
            DatabaseObjectInfo inf = DatabaseObjectRegistry.get(ent);

            //disable property editing unless this object is checked out
            propertyGrid1.Enabled = inf.locked;
            data.mWorld.selectEntity(ent);

            if (inf.locked)
            {
                //if we have it checked out update the tooltip
                lockForEditingToolStripMenuItem.Text = "Checkin";
            }
            else
            {
                lockForEditingToolStripMenuItem.Text = "Checkout";
            }
        }
Exemplo n.º 6
0
        private void removeActorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are sure you wish to remove this actor?", "Remove Actor Confirmation", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                //User wishes to remove the selected entity....
                TabPanelData       data = mMainForm.getTabPanel();
                DatabaseObjectInfo inf  = DatabaseObjectRegistry.get(data.mSelectedEntity);

                //1. remove this entity from the database
                if (Editor.IsConnectedToDatabase())
                {
                    if (inf.locked && Editor.RemoveEntity(data.mActiveLayer.getName(), data.mSelectedEntity))
                    {
                        MessageBox.Show("Entity has been successfully removed from the Database");
                    }
                    else
                    {
                        MessageBox.Show("Entity could not be removed from the Database");
                        return;
                    }
                }

                //2. remove the node associated with this guy....
                TreeNode n = (TreeNode)actorTreeMap[data.mSelectedEntity];
                if (n != null)
                {
                    actorsTreeView1.Nodes.Remove(n);
                }

                //3. deref the hashstring(s) that belong to this entity
                List <GodzGlue.ClassPropertyInfo> cpList = new List <GodzGlue.ClassPropertyInfo>();
                data.mSelectedEntity.getPropertyValues(cpList);

                foreach (ClassPropertyInfo cp in cpList)
                {
                    if (cp.mPropertyType == GodzGlue.ClassPropertyType.PropertyType_HashCode)
                    {
                        uint hash = cp.mObjectHash;
                        Editor.RemoveHash(hash);
                    }
                }

                //4. clean the actorTreeMap / modified actor list
                actorTreeMap.Remove(data.mSelectedEntity);
                modifiedActorList.Remove(data.mSelectedEntity);

                //Finally, remove this entity from the world
                data.mSelectedEntity.removeFromWorld();
                data.mSelectedEntity = null;

                //Deselect the former object
                propertyGrid1.SelectedObject = null;

                //turn off the axis too
                data.mWorld.selectAxis(GizmoAxis.GizmoAxis_None);

                GodzUtil.RunMainPass();
            }
        }
Exemplo n.º 7
0
        public void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (isCharacterMovementActive && e.Button != MouseButtons.Right)
            {
                TabPanelData       data = mMainForm.getTabPanel();
                DatabaseObjectInfo inf  = DatabaseObjectRegistry.get(data.mSelectedEntity);

                if (data.mSelectedEntity != null && inf.locked)
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        //move the selected character along the preferred axis
                        if (mHighlightedAxis != GizmoAxis.GizmoAxis_None)
                        {
                            if (mOldPoint.X == -1)
                            {
                                mOldPoint.X = e.X;
                                mOldPoint.Y = e.Y;
                            }

                            float dx = e.X - mOldPoint.X;
                            float dy = e.Y - mOldPoint.Y;

                            //move character along the gizmo
                            float   scale = 1;
                            Vector3 axis  = new Vector3(0, 0, 0);
                            switch (mHighlightedAxis)
                            {
                            default:
                            {
                            }
                            break;

                            case GizmoAxis.GizmoAxis_X:
                            {
                                axis = new Vector3(1, 0, 0);
                                axis = axis * dx;
                            }
                            break;

                            case GizmoAxis.GizmoAxis_Y:
                            {
                                axis = new Vector3(0, -1, 0);
                                axis = axis * dy;
                            }
                            break;

                            case GizmoAxis.GizmoAxis_Z:
                            {
                                axis = new Vector3(0, 0, 1);
                                axis = axis * dx;
                            }
                            break;
                            } //switch

                            axis = axis * scale;
                            Vector3 pos = data.mSelectedEntity.getLocation();
                            pos = pos + axis;
                            data.mSelectedEntity.setLocation(ref pos);

                            //add this actor to the modified list
                            if (!modifiedActorList.Contains(data.mSelectedEntity))
                            {
                                modifiedActorList.Add(data.mSelectedEntity);
                            }

                            GodzUtil.RunMainPass();

                            //cache mouse pos
                            mOldPoint.X = e.X;
                            mOldPoint.Y = e.Y;
                        }
                    }
                    else
                    {
                        //reset cached mousepoint
                        mOldPoint.X = -1;
                        mOldPoint.Y = -1;

                        //highlight the active axis the character will be moved along....
                        Point p = new Point();
                        p.X = e.X;
                        p.Y = e.Y;

                        mHighlightedAxis = data.mWorld.pickAxis(ref p);

                        //tick the actors so they send events over to renderer
                        GodzUtil.RunMainPass();
                    } //else
                }
            }
            else
            {
                //reset
                mOldPoint.X = -1;
                mOldPoint.Y = -1;
            }
        }