void PopulateMovies(){
			counter=0;
			app = new SelectedObject<Movie>();

			movies = new List<Movie>(){
				new Movie{Title="Meet Joe Black", Languages= new List<Language>(){ 
						new Language{Name= "English"}, new Language{Name= "French"} }},
				new Movie{Title="Eyes Wide Shut", Languages= new List<Language>()
						{ new Language{Name= "German"},
							new Language{Name= 	"French"},
						new Language{Name= "Spanish"}} }
			};
		}
Example #2
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ushort graphic = Graphic;
            ushort hue     = Hue;
            bool   partial = ItemData.IsPartialHue;

            ResetHueVector();

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue     = Constants.OUT_RANGE_COLOR;
                partial = false;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue     = Constants.DEAD_RANGE_COLOR;
                partial = false;
            }

            ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, 0);

            bool isTree = StaticFilters.IsTree(graphic, out _);

            if (isTree && ProfileManager.CurrentProfile.TreeToStumps)
            {
                graphic = Constants.TREE_REPLACE_GRAPHIC;
            }

            if (AlphaHue != 255)
            {
                HueVector.Z = 1f - AlphaHue / 255f;
            }

            DrawStaticAnimated
            (
                batcher,
                graphic,
                posX,
                posY,
                ref HueVector,
                ref DrawTransparent,
                ProfileManager.CurrentProfile.ShadowsEnabled && ProfileManager.CurrentProfile.ShadowsStatics && (isTree || ItemData.IsFoliage || StaticFilters.IsRock(graphic))
            );

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22);
            }

            if (!(SelectedObject.Object == this || FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex))
            {
                if (DrawTransparent)
                {
                    return(true);
                }

                ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
Example #3
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            //Engine.DebugInfo.LandsRendered++;

            ResetHueVector();


            if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                HueVector.X = 0x0023;
                HueVector.Y = 1;
            }
            else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                HueVector.X = Hue;

                if (Hue != 0)
                {
                    HueVector.Y = IsStretched ? ShaderHuesTraslator.SHADER_LAND_HUED : ShaderHuesTraslator.SHADER_HUED;
                }
                else
                {
                    HueVector.Y = IsStretched ? ShaderHuesTraslator.SHADER_LAND : ShaderHuesTraslator.SHADER_NONE;
                }
            }

            if (IsStretched)
            {
                posY += (Z << 2);

                DrawLand(
                    batcher,
                    Graphic, posX, posY,
                    ref Rectangle, ref Normal0, ref Normal1, ref Normal2, ref Normal3,
                    ref HueVector);

                if (SelectedObject.IsPointInStretchedLand(ref Rectangle, posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
            else
            {
                DrawLand(batcher, Graphic, posX, posY, ref HueVector);

                if (SelectedObject.IsPointInLand(posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }

            return(true);
        }
Example #4
0
        int GenerateMapPropButton(string loadPath, string absolutePath, GameObject Prefab)
        {
            string RelativePath = "/" + absolutePath.Replace(MapLuaParser.LoadedMapFolderPath, MapLuaParser.RelativeLoadedMapFolderPath);

            Debug.Log(RelativePath);

            string PropPath = "";

            if (RelativePath.EndsWith(".bp"))
            {
                PropPath = RelativePath.Replace(".bp", "");
            }
            else if (RelativePath.EndsWith(".BP"))
            {
                PropPath = RelativePath.Replace(".BP", "");
            }

            GetGamedataFile.PropObject LoadedProp = GetGamedataFile.LoadProp(GetGamedataFile.MapScd, RelativePath, true);

            GameObject NewButton = Instantiate(Prefab) as GameObject;

            NewButton.transform.SetParent(Pivot, false);

            if (LoadedProp.BP.LODs.Length > 0 && LoadedProp.BP.LODs[0].Albedo)
            {
                NewButton.GetComponent <RawImage>().texture = LoadedProp.BP.LODs[0].Albedo;
            }

            ResourceObject Ro = NewButton.GetComponent <ResourceObject>();

            Ro.InstanceId          = LoadedPaths.Count;
            Ro.NameField.text      = LoadedProp.BP.Name;
            PropPath               = PropPath.Replace(LoadedProp.BP.Name, "");
            Ro.CustomTexts[2].text = PropPath;

            Ro.CustomTexts[0].text = LoadedProp.BP.ReclaimMassMax.ToString();
            Ro.CustomTexts[1].text = LoadedProp.BP.ReclaimEnergyMax.ToString();

            if (LoadedProp.BP.RECLAIMABLE)
            {
                Ro.CustomTexts[0].color = ReclaimColor(LoadedProp.BP.ReclaimMassMax, MaxPropMass);
                Ro.CustomTexts[1].color = ReclaimColor(LoadedProp.BP.ReclaimEnergyMax, MaxPropEnergy);
                Ro.CustomTexts[3].gameObject.SetActive(false);
            }
            else
            {
                Ro.CustomTexts[0].color = ReclaimEmpty;
                Ro.CustomTexts[1].color = ReclaimEmpty;
                Ro.CustomTexts[3].gameObject.SetActive(true);
            }


            LoadedPaths.Add(RelativePath);
            LoadedProps.Add(LoadedProp);

            if (RelativePath.ToLower() == SelectedObject.ToLower())
            {
                Ro.Selected.SetActive(true);
                Pivot.GetComponent <RectTransform>().anchoredPosition = Vector2.up * 250 * Mathf.FloorToInt(LoadedPaths.Count / 5f);
            }

            return(1);
        }
Example #5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            int    num;
            int    num6;
            object obj4;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Class36.SetFocus(Application.DocumentManager.MdiActiveDocument.Window.Handle);
IL_25:
                num2 = 3;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_32:
                num2 = 4;
                Database database = mdiActiveDocument.Database;
IL_3B:
                num2 = 5;
                DocumentLock documentLock = Application.DocumentManager.MdiActiveDocument.LockDocument();
IL_4E:
                num2 = 6;
                this.objectIdCollection_0 = new ObjectIdCollection();
IL_5B:
                num2 = 7;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "TEXT");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value      = selection.Value;
                        IEnumerator  enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            DBText         dbtext         = (DBText)transaction.GetObject(selectedObject.ObjectId, 1);
                            string         text           = JG.HRB(dbtext.TextString);
                            if (text.Contains("@"))
                            {
                                if (this.RadioButton2.Checked)
                                {
                                    if (TcBJFJ_frm.GetBJAS(text) <= this.long_0)
                                    {
                                        DBObjectCollection dbobjectCollection = new DBObjectCollection();
                                        double             num3 = dbtext.Rotation;
                                        if (num3 > 6.2831853071795862)
                                        {
                                            num3 -= 6.2831853071795862;
                                        }
                                        TcBJFJ_frm.GetFuJinDBText(dbtext, dbtext.Height * 3.0, "楼板负筋标注", num3, ref dbobjectCollection);
                                        IEnumerator enumerator2 = dbobjectCollection.GetEnumerator();
                                        while (enumerator2.MoveNext())
                                        {
                                            object obj2    = enumerator2.Current;
                                            DBText dbtext2 = (DBText)obj2;
                                            Class36.smethod_64(dbtext2.ObjectId);
                                        }
                                        if (enumerator2 is IDisposable)
                                        {
                                            (enumerator2 as IDisposable).Dispose();
                                        }
                                        dbobjectCollection = new DBObjectCollection();
                                        TcBJFJ_frm.GetFuJinPL(dbtext, dbtext.Height * 2.0, "楼板负筋钢筋", num3, ref dbobjectCollection);
                                        IEnumerator enumerator3 = dbobjectCollection.GetEnumerator();
                                        while (enumerator3.MoveNext())
                                        {
                                            object   obj3     = enumerator3.Current;
                                            Polyline polyline = (Polyline)obj3;
                                            Class36.smethod_64(polyline.ObjectId);
                                        }
                                        if (enumerator3 is IDisposable)
                                        {
                                            (enumerator3 as IDisposable).Dispose();
                                        }
                                        dbtext.Erase();
                                    }
                                    else
                                    {
                                        this.objectIdCollection_0.Add(dbtext.ObjectId);
                                        dbtext.TextString = dbtext.TextString.Replace("@", "@#");
                                    }
                                }
                                else if (TcBJFJ_frm.GetBJAS(text) <= this.long_0)
                                {
                                    Class36.smethod_64(dbtext.ObjectId);
                                }
                                else
                                {
                                    this.objectIdCollection_0.Add(dbtext.ObjectId);
                                    dbtext.TextString = dbtext.TextString.Replace("@", "@#");
                                }
                            }
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                    }
                    transaction.Commit();
                }
IL_319:
                num2 = 9;
                string[] array3 = this.TextBox1.Text.Split(new char[]
                {
                    '\r'
                });
IL_33E:
                num2 = 10;
                string[] array4 = this.TextBox2.Text.Split(new char[]
                {
                    '\r'
                });
IL_363:
                num2 = 11;
                string[] array5 = array3;
                int      i      = 0;
                checked
                {
                    while (i < array5.Length)
                    {
                        string text2 = array5[i];
IL_379:
                        num2 = 12;
                        Application.DoEvents();
IL_381:
                        num2 = 13;
                        if (Operators.CompareString(text2.Trim(), "", false) != 0)
                        {
IL_3A1:
                            num2 = 14;
                            int num4 = Array.IndexOf <string>(array3, text2);
IL_3AF:
                            num2  = 15;
                            text2 = text2.Trim();
IL_3BB:
                            num2  = 16;
                            text2 = text2.Replace("\r\n", "");
IL_3D1:
                            num2  = 17;
                            text2 = text2.Replace("@", "@#");
IL_3E7:
                            num2         = 18;
                            array4[num4] = array4[num4].Trim();
IL_3F9:
                            num2         = 19;
                            array4[num4] = array4[num4].Replace("\r\n", "");
IL_415:
                            num2         = 20;
                            array4[num4] = array4[num4].Replace("11@", "10/12@");
IL_431:
                            num2         = 21;
                            array4[num4] = array4[num4].Replace("13@", "12/14@");
IL_44D:
                            num2         = 22;
                            array4[num4] = array4[num4].Replace("15@", "14/16@");
IL_469:
                            num2         = 23;
                            array4[num4] = array4[num4].Replace("17@", "16/18@");
IL_485:
                            num2         = 24;
                            array4[num4] = array4[num4].Replace("19@", "18/20@");
IL_4A1:
                            num2         = 25;
                            array4[num4] = array4[num4].Replace("21@", "20/22@");
IL_4BD:
                            num2 = 26;
                            this.ChangeTxt(text2, array4[num4], 6L);
                        }
IL_4D7:
                        i++;
IL_4DD:
                        num2 = 28;
                    }
IL_4ED:
                    num2 = 29;
                    documentLock.Dispose();
IL_4F7:
                    num2 = 30;
                    if (Information.Err().Number <= 0)
                    {
                        goto IL_51E;
                    }
IL_509:
                    num2 = 31;
                    Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_51E:
                    goto IL_600;
                    IL_523 :;
                }
                int num5 = num6 + 1;
                num6 = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num5);
IL_5B7:
                goto IL_5F5;
IL_5B9:
                num6 = num2;
                if (num <= -2)
                {
                    goto IL_523;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_5D2 :;
            }
            catch when(endfilter(obj4 is Exception & num != 0 & num6 == 0))
            {
                Exception ex = (Exception)obj5;

                goto IL_5B9;
            }
IL_5F5:
            throw ProjectData.CreateProjectError(-2146828237);
IL_600:
            if (num6 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
Example #6
0
    private void MouseEvents()
    {
        RaycastHit hit;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
        {
            LaserLabObject target = hit.collider.GetComponent <LaserLabObject>();

            if (target != null)
            {
                if (target != previousHover)
                {
                    if (previousHover != null)
                    {
                        previousHover.OnHoverExit();
                    }
                    target.OnHoverEnter();
                    previousHover = target;
                }

                if (target is BoardObject)
                {
                    BoardObject boardObject = target as BoardObject;
                    Vector2Int  pos         = boardObject.getPos();
                    if (Input.GetMouseButtonDown(0))
                    {
                        if (boardObject.CanRotate)
                        {
                            boardObject.Rotate();
                            CalculateLaserPaths();
                            audioPlayer.PlayClip(rotateSound);
                        }
                        else
                        {
                            audioPlayer.PlayClip(dropSound);
                        }

                        SelectObject(-1);
                    }
                    else if (Input.GetMouseButtonDown(1))
                    {
                        if (boardObject.CanMove)
                        {
                            boardObject.Pickup();
                            level.board.SetBoardObject(pos, null);
                            AddToUnplaced(boardObject);
                            audioPlayer.PlayClip(pickupSound);
                        }
                        else
                        {
                            SelectObject(-1);
                            audioPlayer.PlayClip(dropSound);
                        }
                    }

                    if (selectedObjectIndex > -1)
                    {
                        SelectedObject.SetPreview(false);
                    }
                }
                else if (target is FloorTile)
                {
                    FloorTile  floor = target as FloorTile;
                    Vector2Int pos   = floor.getPos();
                    if (Input.GetMouseButtonDown(0))
                    {
                        if (!level.board.GetBoardObject(pos) && selectedObjectIndex != -1)
                        {
                            Place(pos);
                            audioPlayer.PlayClip(placeSound);
                        }
                        else
                        {
                            SelectObject(-1);
                        }
                    }
                    else if (Input.GetMouseButtonDown(1))
                    {
                        audioPlayer.PlayClip(dropSound);
                        SelectObject(-1);
                    }

                    if (selectedObjectIndex > -1)
                    {
                        if (level.board.GetBoardObject(pos))
                        {
                            SelectedObject.SetPreview(false);
                        }
                        else
                        {
                            SelectedObject.SetPreview(true);
                            SelectedObject.Move(pos);
                        }
                    }
                }
                else if (target is WallObject)
                {
                    WallObject wall = target as WallObject;
                    Vector2Int pos  = wall.getPos();

                    if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && selectedObjectIndex > -1)
                    {
                        audioPlayer.PlayClip(dropSound);
                        SelectObject(-1);
                    }

                    if (selectedObjectIndex > -1)
                    {
                        SelectedObject.SetPreview(false);
                    }
                }
            }
            else
            {
                if (previousHover != null)
                {
                    previousHover.OnHoverExit();
                    previousHover = null;
                }

                if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
                {
                    SelectObject(-1);
                    audioPlayer.PlayClip(dropSound);
                }

                if (selectedObjectIndex > -1)
                {
                    SelectedObject.SetPreview(false);
                }
            }
        }
        else
        {
            if (previousHover != null)
            {
                previousHover.OnHoverExit();
                previousHover = null;
            }

            if (selectedObjectIndex > -1)
            {
                SelectedObject.SetPreview(false);
            }

            if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
            {
                SelectObject(-1);
            }
        }
    }
 public void Copy()
 {
     ClipBoard = SelectedObject.Clone <ObjectType>();
 }
Example #8
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();

            ushort hue = Hue;

            if (State != 0)
            {
                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0)
                {
                    return(false);
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0)
                {
                    hue = 0x002B;
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0)
                {
                    if (AlphaHue >= 192)
                    {
                        AlphaHue = 0xFF;
                    }
                    else
                    {
                        ProcessAlpha(192);
                    }
                }
            }

            ResetHueVector();

            ushort graphic = Graphic;
            bool   partial = ItemData.IsPartialHue;

            if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue     = Constants.OUT_RANGE_COLOR;
                partial = false;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                hue     = Constants.DEAD_RANGE_COLOR;
                partial = false;
            }

            ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, 0);

            //Engine.DebugInfo.MultiRendered++;

            if (IsFromTarget)
            {
                HueVector.Z = 0.5f;
            }

            posX += (int)Offset.X;
            posY += (int)(Offset.Y + Offset.Z);

            if (AlphaHue != 255)
            {
                HueVector.Z = 1f - AlphaHue / 255f;
            }

            DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent);

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>()
                .AddLight(this, this, posX + 22, posY + 22);
            }

            if (!(SelectedObject.Object == this || IsFromTarget ||
                  (FoliageIndex != -1 &&
                   Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex)))
            {
                if (State != 0)
                {
                    if ((State & (CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER |
                                  CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_PREVIEW)) != 0)
                    {
                        return(true);
                    }
                }

                if (DrawTransparent)
                {
                    return(true);
                }

                ref var index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
 private void InitializeSelectedObjectMaterials()
 {
     selectedObjectMaterials.Clear();
     selectedObjectMaterials.AddRange(SelectedObject.GetMaterials());
 }
        void OnSelectionChange()
        {
            if (Selection.activeObject == null)
            {
                m_selectedObject = null;
            }
            else if (m_selectedObject == null || m_selectedObject.m_object != Selection.activeObject)
            {
                SelectedObject obj = m_selectedObjects.Find(item => item.m_object == Selection.activeObject);

                m_selectedObject = obj;

                if (obj == null)
                {
                    string type      = "";
                    string assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);

                    if (AssetDatabase.Contains(Selection.activeInstanceID) == false)
                    {
                        type = "In-Scene";
                    }
                    else
                    {
                        int index = assetPath.LastIndexOf('.');

                        if (index == -1)
                        {
                            type = "Folder";
                        }
                        else
                        {
                            string ending = assetPath.Substring(index);

                            switch (ending)
                            {
                            case ".png":
                            case ".jpg":
                            case ".jpeg":
                                type = "Image";
                                break;

                            case ".cs":
                                type = "Script";
                                break;

                            case ".csv":
                                type = "CSV";
                                break;

                            case ".unity":
                                type = "World";
                                break;

                            case ".prefab":
                                type = "Prefab";
                                break;
                            }
                        }
                    }


                    obj = new SelectedObject()
                    {
                        m_object = Selection.activeObject,
                        m_type   = type
                    };

                    m_selectedObject = obj;
                }
            }
        }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        //Select object on touch
        if (Input.touchCount == 1)
        {
            //Cast a ray on the touch position
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                RaycastHit rayHit;

                //Check if a selectable object was hit and select it
                if (Physics.Raycast(mainCam.ScreenPointToRay(Input.mousePosition), out rayHit, Mathf.Infinity))
                {
                    SelectedObject oldSelectedObject = TheSelectedObject;
                    TheSelectedObject = rayHit.collider.GetComponent <SelectedObject>();

                    //Select object
                    if (TheSelectedObject != null)
                    {
                        if (oldSelectedObject != null && TheSelectedObject != oldSelectedObject)
                        {
                            oldSelectedObject.OnSelect(false);
                        }

                        TheSelectedObject.OnSelect(true);
                    }
                    else
                    {
                        //Deselect object if a selectable object is not clicked
                        if (TheSelectedObject != null)
                        {
                            TheSelectedObject.OnSelect(false);
                            TheSelectedObject = null;
                        }
                    }
                }
                else
                {
                    //Deselect object if nothing is hit
                    if (TheSelectedObject != null)
                    {
                        TheSelectedObject.OnSelect(false);
                        TheSelectedObject = null;
                    }
                }
            }
        }


        //Drag object
        if (Input.touchCount < 1)
        {
            //Disable dragging if there is no touches
            dragging = false;
        }
        else
        {
            // Get the touch position
            var     touch = Input.touches[0];
            Vector2 pos   = touch.position;

            //Check if there is a selected object
            if (TheSelectedObject != null)
            {
                //Check if touch just started
                if (touch.phase == TouchPhase.Began)
                {
                    RaycastHit hit;
                    Ray        ray = mainCam.ScreenPointToRay(pos);

                    //Check if there is an object at that point
                    if (Physics.Raycast(ray, out hit))
                    {
                        dragginDistance = Vector3.Distance(hit.transform.position, Camera.main.transform.position);
                        dragging        = true;
                    }
                }

                //Check if the touch is moved
                if (dragging && touch.phase == TouchPhase.Moved)
                {
                    //When touch is moved - move the position of the object
                    Vector3 position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, dragginDistance);
                    position = mainCam.ScreenToWorldPoint(position);
                    TheSelectedObject.transform.position = position;
                }
            }

            //Check if the touch ended and disable dragging if it did
            if (dragging && (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled))
            {
                dragging = false;
            }
        }


        //Scaling and rotating object
        if (Input.touchCount == 2)
        {
            //Check if one of the touches just began
            if (Input.GetTouch(0).phase == TouchPhase.Began || Input.GetTouch(1).phase == TouchPhase.Began)
            {
                //Set the initial distance between touches and the vector between them, which is needed for rotation
                scalingTouchDistance  = Vector3.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);
                initialRotationVector = Input.GetTouch(1).position - Input.GetTouch(0).position;
            }

            //Check if at least one of the touches is moving
            if (Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved)
            {
                //Get the current distance between the touches and calculate the difference between that and the initial one
                float currentTouchDistance =
                    Vector3.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);

                float deltaDistance = currentTouchDistance - scalingTouchDistance;

                //Get the current vector between the two touches
                Vector3 currentRotationVector = Input.GetTouch(1).position - Input.GetTouch(0).position;

                if (deltaDistance > MinDistanceToPinch)
                {
                    //Check if we have an object selected
                    if (TheSelectedObject)
                    {
                        //Check if we are pinching in or out
                        if (deltaDistance > 0)
                        {
                            //We are pinching out
                            //Increase the scale of the object by the scaling speed
                            Vector3 currentScale = TheSelectedObject.transform.localScale;
                            Vector3 newScale     = new Vector3(currentScale.x + ScalingSpeed, currentScale.y + ScalingSpeed,
                                                               currentScale.z + ScalingSpeed);
                            TheSelectedObject.transform.localScale = newScale;
                        }
                        else if (deltaDistance < 0)
                        {
                            //Pinching in
                            //Decrease the scale of the object by the scaling speed
                            Vector3 currentScale = TheSelectedObject.transform.localScale;
                            Vector3 newScale     = new Vector3(currentScale.x - ScalingSpeed, currentScale.y - ScalingSpeed,
                                                               currentScale.z - ScalingSpeed);
                            TheSelectedObject.transform.localScale = newScale;
                        }
                    }
                }
                else
                {
                    //Handle rotation
                    //Get the angle between the starting vector and current vector between the two touches
                    float currentAngle = Vector3.Angle(initialRotationVector, currentRotationVector);

                    //Get the difference between the x of the vectors so we can check what direction is the user rrotating
                    float deltaX = currentRotationVector.x - initialRotationVector.x;
                    if (TheSelectedObject)
                    {
                        //Rotate the object in the appropriate direction
                        if (Mathf.Abs(currentAngle) > 1f)
                        {
                            if (deltaX > 0)
                            {
                                TheSelectedObject.transform.Rotate(0, 0, currentAngle,
                                                                   Space.World);
                            }
                            else if (deltaX < 0)
                            {
                                TheSelectedObject.transform.Rotate(0, 0, -currentAngle,
                                                                   Space.World);
                            }
                            initialRotationVector = currentRotationVector;
                        }
                    }
                    else
                    {
                        //Rotate the camera in the appropriate direction
                        if (Mathf.Abs(currentAngle) > 1f)
                        {
                            if (deltaX > 0)
                            {
                                mainCam.transform.Rotate(0, currentAngle, 0,
                                                         Space.World);
                            }
                            else if (deltaX < 0)
                            {
                                mainCam.transform.Rotate(0, -currentAngle, 0,
                                                         Space.World);
                            }
                            initialRotationVector = currentRotationVector;
                        }
                    }
                }

                //Reset the touch distance and the initial vector at end of touch
                if (Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(1).phase == TouchPhase.Ended)
                {
                    scalingTouchDistance  = 0;
                    initialRotationVector = currentRotationVector;
                }
            }
        }
    }
        void LayoutItem(int i, SelectedObject obj)
        {
            if (m_eraseButtonStyle == null)
            {
                m_eraseButtonStyle = new GUIStyle();
                m_eraseButtonStyle.stretchWidth = false;
                m_eraseButtonStyle.margin.top   = 3;
                m_eraseButtonStyle.margin.left  = 5;
                m_eraseButtonStyle.margin.right = 5;
            }

            if (m_typeLabelStyle == null)
            {
                m_typeLabelStyle = EditorStyles.label;
                m_typeLabelStyle.stretchWidth = false;
                m_typeLabelStyle.margin.top   = 3;
                m_typeLabelStyle.margin.left  = 5;
                m_typeLabelStyle.margin.right = 5;
                m_typeLabelStyle.alignment    = TextAnchor.MiddleCenter;
            }

            GUIStyle style = EditorStyles.miniButtonLeft;

            style.alignment    = TextAnchor.MiddleLeft;
            style.stretchWidth = true;

            if (obj != null && obj.m_object != null)
            {
                GUILayout.BeginHorizontal();

                if (obj == m_selectedObject)
                {
                    GUI.enabled = false;
                }

                string objName = obj.m_object.name;

                if (GUILayout.Button(objName, style))
                {
                    m_selectedObject       = obj;
                    Selection.activeObject = obj.m_object;
                }

                GUI.enabled = true;

                GUILayout.Label(obj.m_type, m_typeLabelStyle);

                if (GUILayout.Button(EditorGUIUtility.IconContent("Toolbar Minus"), m_eraseButtonStyle))
                {
                    for (int j = m_selectedObjects.Count - 1; j >= 0; --j)
                    {
                        if (m_selectedObjects[j] == obj)
                        {
                            m_selectedObjects.RemoveAt(j);
                        }
                    }
                }

                GUILayout.EndHorizontal();
            }
        }
Example #13
0
 public async Task InitializeLater()
 {
     await SelectedObject.GetSoundOrigin();
 }
Example #14
0
    public bool ProcessEvent(Event e)
    {
        if (!MapLogic.Instance.IsLoaded)
        {
            if (MapLogic.Instance.IsLoading)
            {
                MouseCursor.SetCursor(MouseCursor.CurWait);
            }
            return(false);
        }

        if (e.type == EventType.KeyDown)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = -1;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = 1;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = -1;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = 1;
                }
                return(true);

            case KeyCode.Plus:
            case KeyCode.Equals:     // + = =
            case KeyCode.KeypadPlus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed++;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.Minus:
            case KeyCode.KeypadMinus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed--;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.F3:
                //if (NetworkManager.IsClient)
            {
                DiplomacyWindow wnd = Utils.CreateObjectWithScript <DiplomacyWindow>();
                //Debug.LogFormat("created a window!");
            }
                return(true);

            case KeyCode.Escape:
            {
                // todo: create main menu
                ExampleWindow wnd = Utils.CreateObjectWithScript <ExampleWindow>();
            }
                return(true);

            case KeyCode.Space:
                // check if local unit is dead.
                // for dead local unit, space sends respawn.
                // for alive local unit, space toggles both spellbook and inventory.
                if (MapLogic.Instance.ConsolePlayer != null &&
                    !MapLogic.Instance.ConsolePlayer.Avatar.IsAlive)
                {
                    Client.SendRespawn();
                }
                else
                {
                    bool cstate = InventoryVisible && SpellbookVisible;
                    InventoryVisible = !cstate;
                    SpellbookVisible = !cstate;
                    Spellbook.Update();
                }
                return(true);

            case KeyCode.BackQuote:
                InventoryVisible = !InventoryVisible;
                Spellbook.Update();
                return(true);

            case KeyCode.Q:
                SpellbookVisible = !SpellbookVisible;
                Spellbook.Update();
                return(true);
            }
        }
        else if (e.type == EventType.KeyUp)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == -1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == -1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);
            }
        }
        else if (e.rawType == EventType.MouseMove)
        {
            UpdateInput();
            return(true);
        }
        else if (e.rawType == EventType.MouseDown && e.button == 0)
        {
            // select unit if not selected yet
            if (HoveredObject != null &&
                (SelectedObject == null || (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move && GetCastSpell() == Spell.Spells.NoneSpell &&
                                            !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt)) || (Commandbar.CurrentCommand == 0)))
            {
                SelectedObject = HoveredObject;
                OnObjectSelected(SelectedObject);
            }
            else if (SelectedObject != null && SelectedObject is IPlayerPawn && ((IPlayerPawn)SelectedObject).GetPlayer() == MapLogic.Instance.ConsolePlayer)
            {
                // todo: handle commands here
                // try to walk.
                if (SelectedObject.GetObjectType() == MapObjectType.Monster ||
                    SelectedObject.GetObjectType() == MapObjectType.Human)
                {
                    MapUnit      unit     = (MapUnit)SelectedObject;
                    Spell.Spells castSpId = GetCastSpell();
                    if (castSpId != Spell.Spells.NoneSpell && (MapLogic.Instance.Nodes[MouseCellX, MouseCellY].Flags & MapNodeFlags.Visible) != 0)
                    {
                        Spell castSp = GetOneTimeCast();
                        if (castSp == null)
                        {
                            castSp = unit.GetSpell(castSpId);
                        }
                        if (HoveredObject != null && (HoveredObject.GetObjectType() == MapObjectType.Monster ||
                                                      HoveredObject.GetObjectType() == MapObjectType.Human))
                        {
                            Client.SendCastToUnit(unit, castSp, (MapUnit)HoveredObject, MouseCellX, MouseCellY);
                        }
                        else
                        {
                            Client.SendCastToArea(unit, castSp, MouseCellX, MouseCellY);
                        }
                        if (castSp == OneTimeCast || Commandbar.CurrentCommandActual == MapViewCommandbar.Commands.Cast)
                        {
                            SpellbookVisible = false;
                            if (Commandbar.CurrentCommandActual == MapViewCommandbar.Commands.Cast)
                            {
                                Commandbar.InitDefault(SelectedObject);
                            }
                        }
                        OneTimeCast = null;
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move)
                    {
                        Client.SendMoveUnit(unit, MouseCellX, MouseCellY);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Attack &&
                             HoveredObject != null &&
                             (HoveredObject.GetObjectType() == MapObjectType.Monster ||
                              HoveredObject.GetObjectType() == MapObjectType.Human))
                    {
                        Client.SendAttackUnit(unit, (MapUnit)HoveredObject);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Pickup &&
                             MapLogic.Instance.GetSackAt(MouseCellX, MouseCellY) != null)
                    {
                        Client.SendPickupUnit(unit, MouseCellX, MouseCellY); // issue sack pickup command by current unit at target coordinates
                    }
                }
            }

            return(true);
        }
        else if (e.rawType == EventType.MouseDown && e.button == 1)
        {
            // logic: if currently casting a scroll, cancel cast from item
            if (GetOneTimeCast() != null)
            {
                OneTimeCast = null;
                return(true);
            }

            // logic: if spellbook is open and some spell is selected, set spell to NoneSpell
            // player clicked somewhere not on the book (presumably over the map)
            if (SpellbookVisible)
            {
                if (Spellbook.ActiveSpell != Spell.Spells.NoneSpell)
                {
                    Spellbook.ActiveSpell = Spell.Spells.NoneSpell;
                    return(true);
                }
            }

            SelectedObject             = null; // deselect
            Commandbar.EnabledCommands = 0;
            return(true);
        }

        return(false);
    }
Example #15
0
    void Update()
    {
        MiniMap.gameObject.SetActive(MapLogic.Instance.IsLoaded);
        Commandbar.gameObject.SetActive(MapLogic.Instance.IsLoaded);
        Infowindow.gameObject.SetActive(MapLogic.Instance.IsLoaded);
        Inventory.gameObject.SetActive(InventoryVisible);
        Spellbook.gameObject.SetActive(SpellbookVisible);

        if (!MapLogic.Instance.IsLoaded)
        {
            return;
        }

        if (GridMeshMaterial == null || FOWMeshMaterial == null || MeshMaterial == null)
        {
            return;
        }

        if (GridEnabled)
        {
            GridMeshMaterial.color = new Color(1, 0, 0, 0.5f);
        }
        else
        {
            GridMeshMaterial.color = new Color(0, 0, 0, 0);
        }

        // update lighting.
        Texture2D lightTex = MapLogic.Instance.CheckLightingTexture();

        if (lightTex != null)
        {
            UpdateLighting(lightTex);
        }
        Texture2D fowTex = MapLogic.Instance.CheckFOWTexture();

        if (fowTex != null)
        {
            UpdateFOW(fowTex);
        }

        if (HoveredObject != null && (HoveredObject.GetObjectType() == MapObjectType.Monster ||
                                      HoveredObject.GetObjectType() == MapObjectType.Human) && (!((MapUnit)HoveredObject).IsAlive || !HoveredObject.IsLinked))
        {
            HoveredObject = null;
        }
        if (SelectedObject != null && (SelectedObject.GetObjectType() == MapObjectType.Monster ||
                                       SelectedObject.GetObjectType() == MapObjectType.Human) && (!((MapUnit)SelectedObject).IsAlive || !SelectedObject.IsLinked))
        {
            SelectedObject = null;
        }

        UpdateLogic();

        int waterAnimFrameNew = (MapLogic.Instance.LevelTime % 20) / 5;

        if (WaterAnimFrame != waterAnimFrameNew)
        {
            WaterAnimFrame = waterAnimFrameNew;
            UpdateTiles(WaterAnimFrame);
        }

        // update scrolling
        scrollTimer += Time.unscaledDeltaTime;
        if (scrollTimer > 0.01)
        {
            SetScroll(ScrollX + ScrollDeltaX, ScrollY + ScrollDeltaY);
            scrollTimer = 0;
        }
    }
Example #16
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();

            ushort hue   = Hue;
            float  alpha = 0;

            if (State != 0)
            {
                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0)
                {
                    return(false);
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0)
                {
                    hue = 0x002B;
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0)
                {
                    if (AlphaHue >= 192)
                    {
                        alpha    = 0.25f;
                        AlphaHue = 0xFF;
                    }
                    else
                    {
                        ProcessAlpha(192);
                    }
                }
            }

            ushort graphic = Graphic;

            if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                HueVector.X = 0x0023;
                HueVector.Y = 1;
            }
            else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, hue, ItemData.IsPartialHue, alpha);
            }

            //Engine.DebugInfo.MultiRendered++;

            if (IsFromTarget)
            {
                HueVector.Z = 0.5f;
            }

            posX += (int)Offset.X;
            posY += (int)(Offset.Y + Offset.Z);

            if (DrawTransparent)
            {
                int maxDist = ProfileManager.Current.CircleOfTransparencyRadius + 44;
                int fx      = (int)(World.Player.RealScreenPosition.X + World.Player.Offset.X);
                int fy      = (int)(World.Player.RealScreenPosition.Y + (World.Player.Offset.Y - World.Player.Offset.Z));

                fx -= posX;
                fy -= posY;

                int dist = (int)Math.Sqrt(fx * fx + fy * fy);

                if (dist <= maxDist)
                {
                    switch (ProfileManager.Current.CircleOfTransparencyType)
                    {
                    default:
                    case 0:
                        HueVector.Z = 0.75f;
                        break;

                    case 1:
                        HueVector.Z = MathHelper.Lerp(1f, 0f, (dist / (float)maxDist));
                        break;
                    }

                    DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector);

                    if (AlphaHue != 255)
                    {
                        HueVector.Z = 1f - AlphaHue / 255f;
                    }
                    else
                    {
                        HueVector.Z = 0;
                    }

                    batcher.SetStencil(StaticTransparentStencil.Value);
                    DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector);
                    batcher.SetStencil(null);
                }
                else
                {
                    if (AlphaHue != 255)
                    {
                        HueVector.Z = 1f - AlphaHue / 255f;
                    }

                    DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector);
                }
            }
            else
            {
                if (AlphaHue != 255)
                {
                    HueVector.Z = 1f - AlphaHue / 255f;
                }

                DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector);
            }

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>()
                .AddLight(this, this, posX + 22, posY + 22);
            }

            if (!(SelectedObject.Object == this || IsFromTarget ||
                  (FoliageIndex != -1 &&
                   Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex)))
            {
                if (State != 0)
                {
                    if ((State & (CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER |
                                  CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_PREVIEW)) != 0)
                    {
                        return(true);
                    }
                }

                if (DrawTransparent)
                {
                    return(true);
                }

                ref var index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
Example #17
0
        public object GetGuJinPoint(ref Point3d P1, ref Point3d P2)
        {
            int    num;
            object obj2;
            int    num8;
            object obj3;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_16:
                num2 = 3;
                Database database = mdiActiveDocument.Database;
IL_1F:
                num2 = 4;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "LWPOLYLINE");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value      = selection.Value;
                        Entity       e          = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                        Point3d      entCenter  = CAD.GetEntCenter(e);
                        double       num3       = entCenter.X;
                        double       num4       = entCenter.Y;
                        double       num5       = entCenter.X;
                        double       num6       = entCenter.Y;
                        IEnumerator  enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            e         = (Entity)transaction.GetObject(selectedObject.ObjectId, 0);
                            entCenter = CAD.GetEntCenter(e);
                            num3      = Math.Min(entCenter.X, num3);
                            num4      = Math.Min(entCenter.Y, num4);
                            num5      = Math.Max(entCenter.X, num5);
                            num6      = Math.Max(entCenter.Y, num6);
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                        P1..ctor(num3, num4, 0.0);
                        P2..ctor(num5, num6, 0.0);
                    }
                    transaction.Commit();
                }
IL_1AC:
                num2 = 6;
                if (Information.Err().Number <= 0)
                {
                    goto IL_1D1;
                }
IL_1BD:
                num2 = 7;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_1D1:
                num2 = 9;
                obj2 = true;
IL_1E1:
                goto IL_261;
IL_1E3:
                int num7 = num8 + 1;
                num8     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num7);
IL_21B:
                goto IL_256;
IL_21D:
                num8 = num2;
                if (num <= -2)
                {
                    goto IL_1E3;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_233 :;
            }
            catch when(endfilter(obj3 is Exception & num != 0 & num8 == 0))
            {
                Exception ex = (Exception)obj4;

                goto IL_21D;
            }
IL_256:
            throw ProjectData.CreateProjectError(-2146828237);
IL_261:
            object result = obj2;

            if (num8 != 0)
            {
                ProjectData.ClearProjectError();
            }
            return(result);
        }
        void LayoutItem(int i, SelectedObject obj)
        {
            // Lazy create and cache lock button style
            if (m_lockButtonStyle == null)
            {
                GUIStyle temp = "IN LockButton";
                m_lockButtonStyle              = new GUIStyle(temp);
                m_lockButtonStyle.margin.top   = 3;
                m_lockButtonStyle.margin.left  = 10;
                m_lockButtonStyle.margin.right = 10;
            }

            GUIStyle style = EditorStyles.miniButtonLeft;

            style.alignment = TextAnchor.MiddleLeft;

            if (obj != null && obj.m_object != null)
            {
                GUILayout.BeginHorizontal();


                bool wasLocked = obj.m_locked;
                obj.m_locked = GUILayout.Toggle(obj.m_locked, GUIContent.none, m_lockButtonStyle);
                if (wasLocked != obj.m_locked)
                {
                    m_selectedObjects.Remove(obj);
                    int firstNonLocked = (m_selectedObjects.FindIndex(item => item.m_locked == true));

                    if (firstNonLocked >= 0)
                    {
                        m_selectedObjects.Insert(firstNonLocked, obj);
                    }
                    else
                    {
                        m_selectedObjects.Add(obj);
                    }
                }

                /* // Enable "up arrow" that lets you move item to top of list. Not really that useful now there's the "lock"
                 * if ( GUILayout.Button( "\u25B2", EditorStyles.miniButtonLeft, GUILayout.MaxWidth(20) ) )
                 * {
                 *      m_selectedObject = obj;
                 *      Selection.activeObject = obj.m_object;
                 *
                 *      // Move to top
                 *      m_selectedObjects.Remove(obj);
                 *      int firstNonLocked = ( m_selectedObjects.FindIndex(item => item.m_locked == true) );
                 *      if ( obj.m_locked == false && firstNonLocked >= 0 )
                 *      {
                 *              m_selectedObjects.Insert(firstNonLocked, obj );
                 *      }
                 *      else
                 *      {
                 *              m_selectedObjects.Add( obj );
                 *      }
                 * }
                 */

                if (obj == m_selectedObject)
                {
                    GUI.enabled = false;
                }

                string objName = obj.m_object.name;
                if (obj.m_inScene)
                {
                    objName += STRING_INSCENE; // Append string to scene instances to easily tell them apart
                }
                if (GUILayout.Button(objName, style))
                {
                    m_selectedObject       = obj;
                    Selection.activeObject = obj.m_object;
                }

                GUI.enabled = true;

                // Lazy find and cache Search button
                if (m_searchButtonContent == null)
                {
                    m_searchButtonContent = EditorGUIUtility.IconContent("d_ViewToolZoom");
                }

                if (GUILayout.Button(m_searchButtonContent, EditorStyles.miniButtonRight, GUILayout.MaxWidth(25), GUILayout.MaxHeight(15)))
                {
                    EditorGUIUtility.PingObject(obj.m_object);
                }

                GUILayout.EndHorizontal();
            }
        }
Example #19
0
        void LayoutItem(int i, SelectedObject obj)
        {
            // Lazy create and cache lock button style
            if (_lockButtonStyle == null)
            {
                GUIStyle temp = "IN LockButton";
                _lockButtonStyle              = new GUIStyle(temp);
                _lockButtonStyle.margin.top   = 3;
                _lockButtonStyle.margin.left  = 10;
                _lockButtonStyle.margin.right = 10;
            }

            GUIStyle style = EditorStyles.miniButtonLeft;

            style.alignment = TextAnchor.MiddleLeft;

            if (obj != null && obj.selection != null)
            {
                bool shouldBeSeen = _visibleElements == EVisibleElements.Any ||
                                    obj.inScene && _visibleElements == EVisibleElements.Scene ||
                                    !obj.inScene && _visibleElements == EVisibleElements.Project;

                if (!shouldBeSeen)
                {
                    return;
                }

                GUILayout.BeginHorizontal();

                bool wasLocked = obj.locked;
                obj.locked = GUILayout.Toggle(obj.locked, GUIContent.none, _lockButtonStyle);
                if (wasLocked != obj.locked)
                {
                    _selectedObjects.Remove(obj);
                    int firstNonLocked = (_selectedObjects.FindIndex(item => item.locked == true));

                    if (firstNonLocked >= 0)
                    {
                        _selectedObjects.Insert(firstNonLocked, obj);
                    }
                    else
                    {
                        _selectedObjects.Add(obj);
                    }
                }

                if (obj == _selectedObject)
                {
                    GUI.enabled = false;
                }

                string objName = obj.selection.name;
                if (obj.inScene)
                {
                    string sceneName = SceneManager.GetActiveScene().name;
                    objName = string.Format("{0}{1}{2}",
                                            objName,                                                                        // Base Name
                                            _visibleElements == EVisibleElements.Any ? _SCENE_ITEM_APPENDIX : string.Empty, // "Is In Scene Mark" (If Needed)
                                                                                                                            // Scene Name (If Needed, Could Get Trimmed If Too Long)
                                            _visibleElements == EVisibleElements.Any ? string.Format(" - (Scene: \"{0}{1}\")", sceneName.Substring(0, sceneName.Length <= _MAX_SCENE_NAME_SIZE ? sceneName.Length : _MAX_SCENE_NAME_SIZE),
                                                                                                     sceneName.Length <= _MAX_SCENE_NAME_SIZE ? string.Empty : "...") : string.Empty);
                }
                if (GUILayout.Button(objName, style))
                {
                    _selectedObject        = obj;
                    Selection.activeObject = obj.selection;
                }

                GUI.enabled = true;

                // Lazy find and cache Search button
                if (_searchButtonContent == null)
                {
                    _searchButtonContent = EditorGUIUtility.IconContent("d_ViewToolZoom");
                }

                if (GUILayout.Button(_searchButtonContent, EditorStyles.miniButtonRight, GUILayout.MaxWidth(25), GUILayout.MaxHeight(15)))
                {
                    EditorGUIUtility.PingObject(obj.selection);
                }

                GUILayout.EndHorizontal();
            }
        }
Example #20
0
        public void TcQGJ_X()
        {
            int    num;
            int    num8;
            object obj2;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_16:
                num2 = 3;
                Database database = mdiActiveDocument.Database;
IL_1F:
                num2 = 4;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "LWPOLYLINE");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value      = selection.Value;
                        Entity       e          = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                        Point3d      entCenter  = CAD.GetEntCenter(e);
                        double       num3       = entCenter.X;
                        double       num4       = entCenter.Y;
                        double       num5       = entCenter.X;
                        double       num6       = entCenter.Y;
                        IEnumerator  enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            e         = (Entity)transaction.GetObject(selectedObject.ObjectId, 0);
                            entCenter = CAD.GetEntCenter(e);
                            num3      = Math.Min(entCenter.X, num3);
                            num4      = Math.Min(entCenter.Y, num4);
                            num5      = Math.Max(entCenter.X, num5);
                            num6      = Math.Max(entCenter.Y, num6);
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                        Point3d point3d_;
                        point3d_..ctor(num3, num4, 0.0);
                        Point3d point3d_2;
                        point3d_2..ctor(num5, num6, 0.0);
                        Class36.smethod_14(point3d_, point3d_2, Class36.double_0 / 2.0);
                    }
                    transaction.Commit();
                }
IL_1C7:
                num2 = 6;
                if (Information.Err().Number <= 0)
                {
                    goto IL_1EC;
                }
IL_1D8:
                num2 = 7;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_1EC:
                goto IL_268;
IL_1EE:
                int num7 = num8 + 1;
                num8     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num7);
IL_222:
                goto IL_25D;
IL_224:
                num8 = num2;
                if (num <= -2)
                {
                    goto IL_1EE;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_23A :;
            }
            catch when(endfilter(obj2 is Exception & num != 0 & num8 == 0))
            {
                Exception ex = (Exception)obj3;

                goto IL_224;
            }
IL_25D:
            throw ProjectData.CreateProjectError(-2146828237);
IL_268:
            if (num8 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
Example #21
0
        CollectEvent(object sender, CollectorEventArgs e)
        {
            // cast the sender object to the SnoopCollector we are expecting
            Collector snoopCollector = sender as Collector;

            if (snoopCollector == null)
            {
                Debug.Assert(false);    // why did someone else send us the message?
                return;
            }

            // see if it is a type we are responsible for
            Editor editor = e.ObjToSnoop as Editor;

            if (editor != null)
            {
                Stream(snoopCollector.Data(), editor);
                return;
            }

            PromptOptions promptOpts = e.ObjToSnoop as PromptOptions;

            if (promptOpts != null)
            {
                Stream(snoopCollector.Data(), promptOpts);
                return;
            }

            PromptStringOptionsEventArgs promptStringArgs = e.ObjToSnoop as PromptStringOptionsEventArgs;

            if (promptStringArgs != null)
            {
                Stream(snoopCollector.Data(), promptStringArgs);
                return;
            }

            PromptSelectionOptionsEventArgs promptSelectionArgs = e.ObjToSnoop as PromptSelectionOptionsEventArgs;

            if (promptSelectionArgs != null)
            {
                Stream(snoopCollector.Data(), promptSelectionArgs);
                return;
            }

            PromptSelectionOptions promptSelectionOpts = e.ObjToSnoop as PromptSelectionOptions;

            if (promptSelectionOpts != null)
            {
                Stream(snoopCollector.Data(), promptSelectionOpts);
                return;
            }

            PromptPointOptionsEventArgs promptPointArgs = e.ObjToSnoop as PromptPointOptionsEventArgs;

            if (promptPointArgs != null)
            {
                Stream(snoopCollector.Data(), promptPointArgs);
                return;
            }

            PromptNestedEntityResultEventArgs promptNestResultArgs = e.ObjToSnoop as PromptNestedEntityResultEventArgs;

            if (promptNestResultArgs != null)
            {
                Stream(snoopCollector.Data(), promptNestResultArgs);
                return;
            }

            PromptResult promptResult = e.ObjToSnoop as PromptResult;

            if (promptResult != null)
            {
                Stream(snoopCollector.Data(), promptResult);
                return;
            }

            PromptKeywordOptionsEventArgs promptKeywordArgs = e.ObjToSnoop as PromptKeywordOptionsEventArgs;

            if (promptKeywordArgs != null)
            {
                Stream(snoopCollector.Data(), promptKeywordArgs);
                return;
            }

            PromptIntegerOptionsEventArgs promptIntArgs = e.ObjToSnoop as PromptIntegerOptionsEventArgs;

            if (promptIntArgs != null)
            {
                Stream(snoopCollector.Data(), promptIntArgs);
                return;
            }

            PromptEntityOptionsEventArgs promptEntArgs = e.ObjToSnoop as PromptEntityOptionsEventArgs;

            if (promptEntArgs != null)
            {
                Stream(snoopCollector.Data(), promptEntArgs);
                return;
            }

            PromptDoubleOptionsEventArgs promptDoubleArgs = e.ObjToSnoop as PromptDoubleOptionsEventArgs;

            if (promptDoubleArgs != null)
            {
                Stream(snoopCollector.Data(), promptDoubleArgs);
                return;
            }

            PromptSelectionResult prSelRes = e.ObjToSnoop as PromptSelectionResult;

            if (prSelRes != null)
            {
                Stream(snoopCollector.Data(), prSelRes);
                return;
            }

            SelectionSet selSet = e.ObjToSnoop as SelectionSet;

            if (selSet != null)
            {
                Stream(snoopCollector.Data(), selSet);
                return;
            }

            SelectedObject selObj = e.ObjToSnoop as SelectedObject;

            if (selObj != null)
            {
                Stream(snoopCollector.Data(), selObj);
                return;
            }

            SelectedSubObject selSubObj = e.ObjToSnoop as SelectedSubObject;

            if (selSubObj != null)
            {
                Stream(snoopCollector.Data(), selSubObj);
                return;
            }

            SelectionDetails selDetails = e.ObjToSnoop as SelectionDetails;

            if (selDetails != null)
            {
                Stream(snoopCollector.Data(), selDetails);
                return;
            }

            SelectionRemovedEventArgs selRemovedArgs = e.ObjToSnoop as SelectionRemovedEventArgs;

            if (selRemovedArgs != null)
            {
                Stream(snoopCollector.Data(), selRemovedArgs);
                return;
            }

            SelectionAddedEventArgs selAddedArgs = e.ObjToSnoop as SelectionAddedEventArgs;

            if (selAddedArgs != null)
            {
                Stream(snoopCollector.Data(), selAddedArgs);
                return;
            }

            DraggingEndedEventArgs dragEndArgs = e.ObjToSnoop as DraggingEndedEventArgs;

            if (dragEndArgs != null)
            {
                Stream(snoopCollector.Data(), dragEndArgs);
                return;
            }

            InputPointContext inputPtCntxt = e.ObjToSnoop as InputPointContext;

            if (inputPtCntxt != null)
            {
                Stream(snoopCollector.Data(), inputPtCntxt);
                return;
            }

            Keyword keyword = e.ObjToSnoop as Keyword;

            if (keyword != null)
            {
                Stream(snoopCollector.Data(), keyword);
                return;
            }

            PointFilterEventArgs ptFilterEventArgs = e.ObjToSnoop as PointFilterEventArgs;

            if (ptFilterEventArgs != null)
            {
                Stream(snoopCollector.Data(), ptFilterEventArgs);
                return;
            }

            PointFilterResult ptFilterRes = e.ObjToSnoop as PointFilterResult;

            if (ptFilterRes != null)
            {
                Stream(snoopCollector.Data(), ptFilterRes);
                return;
            }

            PointMonitorEventArgs ptMonitorArgs = e.ObjToSnoop as PointMonitorEventArgs;

            if (ptMonitorArgs != null)
            {
                Stream(snoopCollector.Data(), ptMonitorArgs);
                return;
            }

            PromptAngleOptionsEventArgs promptAngleOptsArgs = e.ObjToSnoop as PromptAngleOptionsEventArgs;

            if (promptAngleOptsArgs != null)
            {
                Stream(snoopCollector.Data(), promptAngleOptsArgs);
                return;
            }

            PromptDistanceOptionsEventArgs promptDistanceOptsArgs = e.ObjToSnoop as PromptDistanceOptionsEventArgs;

            if (promptDistanceOptsArgs != null)
            {
                Stream(snoopCollector.Data(), promptDistanceOptsArgs);
                return;
            }

            PromptDoubleResultEventArgs promptDoubleResArgs = e.ObjToSnoop as PromptDoubleResultEventArgs;

            if (promptDoubleResArgs != null)
            {
                Stream(snoopCollector.Data(), promptDoubleResArgs);
                return;
            }

            PromptFileOptions promptFileOpts = e.ObjToSnoop as PromptFileOptions;

            if (promptFileOpts != null)
            {
                Stream(snoopCollector.Data(), promptFileOpts);
                return;
            }

            PromptForEntityEndingEventArgs promptForEntEndArgs = e.ObjToSnoop as PromptForEntityEndingEventArgs;

            if (promptForEntEndArgs != null)
            {
                Stream(snoopCollector.Data(), promptForEntEndArgs);
                return;
            }

            PromptForSelectionEndingEventArgs promptForSelEndArgs = e.ObjToSnoop as PromptForSelectionEndingEventArgs;

            if (promptForSelEndArgs != null)
            {
                Stream(snoopCollector.Data(), promptForSelEndArgs);
                return;
            }

            PromptNestedEntityOptions promptNestEntOpts = e.ObjToSnoop as PromptNestedEntityOptions;

            if (promptNestEntOpts != null)
            {
                Stream(snoopCollector.Data(), promptNestEntOpts);
                return;
            }

            PromptNestedEntityOptionsEventArgs promptNestEntOptsArgs = e.ObjToSnoop as PromptNestedEntityOptionsEventArgs;

            if (promptNestEntOptsArgs != null)
            {
                Stream(snoopCollector.Data(), promptNestEntOptsArgs);
                return;
            }

            PromptSelectionResultEventArgs promptSelResArgs = e.ObjToSnoop as PromptSelectionResultEventArgs;

            if (promptSelResArgs != null)
            {
                Stream(snoopCollector.Data(), promptSelResArgs);
                return;
            }

            // ValueTypes we have to treat a bit different
            if (e.ObjToSnoop is PickPointDescriptor)
            {
                Stream(snoopCollector.Data(), (PickPointDescriptor)e.ObjToSnoop);
                return;
            }
        }
Example #22
0
        public void TcGJDY()
        {
            Document           mdiActiveDocument  = Application.DocumentManager.MdiActiveDocument;
            Database           database           = mdiActiveDocument.Database;
            ObjectIdCollection objectIdCollection = new ObjectIdCollection();
            DBObjectCollection dbobjectCollection = new DBObjectCollection();

            TypedValue[] array  = new TypedValue[1];
            Array        array2 = array;
            TypedValue   typedValue;

            typedValue..ctor(0, "LWPOLYLINE");
            array2.SetValue(typedValue, 0);
            SelectionFilter       selectionFilter = new SelectionFilter(array);
            PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
            Point3d entCenter;

            if (selection.Status == 5100)
            {
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    SelectionSet value    = selection.Value;
                    double       num      = double.MinValue;
                    Polyline     polyline = null;
                    try
                    {
                        foreach (object obj in value)
                        {
                            SelectedObject selectedObject = (SelectedObject)obj;
                            Polyline       polyline2      = (Polyline)transaction.GetObject(selectedObject.ObjectId, 1);
                            if (!polyline2.Closed && polyline2.Area > num)
                            {
                                num       = polyline2.Area;
                                polyline  = polyline2;
                                entCenter = CAD.GetEntCenter(polyline2);
                            }
                        }
                    }
                    finally
                    {
                        IEnumerator enumerator;
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                    }
                    dbobjectCollection.Add(polyline);
                    try
                    {
                        foreach (object obj2 in value)
                        {
                            SelectedObject selectedObject2 = (SelectedObject)obj2;
                            Polyline       polyline3       = (Polyline)transaction.GetObject(selectedObject2.ObjectId, 1);
                            if (polyline3.GetStartWidthAt(0) != 0.0 && polyline3.Area > 10000.0 && !polyline3.Closed)
                            {
                                Polyline polyline4 = (Polyline)polyline3.Clone();
                                CAD.EntScale(polyline4, entCenter, 0.3);
                                if (!dbobjectCollection.Contains(polyline3))
                                {
                                    double num2 = polyline3.GeometricExtents.MinPoint.GetVectorTo(polyline3.GeometricExtents.MaxPoint).AngleOnPlane(new Plane());
                                    if (num2 > 0.78539816339744828)
                                    {
                                        CAD.EntMove(polyline4.ObjectId, entCenter, CAD.GetPointXY(entCenter, 50.0, 75.0));
                                    }
                                    else
                                    {
                                        CAD.EntMove(polyline4.ObjectId, entCenter, CAD.GetPointXY(entCenter, 75.0, 50.0));
                                    }
                                }
                                CAD.AddEnt(polyline4);
                                objectIdCollection.Add(polyline4.ObjectId);
                            }
                        }
                    }
                    finally
                    {
                        IEnumerator enumerator2;
                        if (enumerator2 is IDisposable)
                        {
                            (enumerator2 as IDisposable).Dispose();
                        }
                    }
                    transaction.Commit();
                }
            }
            JigEntIDs1 jigEntIDs = new JigEntIDs1();

            jigEntIDs.method_0(objectIdCollection, entCenter);
            if (Information.Err().Number > 0)
            {
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
            }
        }
Example #23
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            //Engine.DebugInfo.ItemsRendered++;

            ResetHueVector();
            DrawTransparent = false;

            posX += (int)Offset.X;
            posY += (int)(Offset.Y + Offset.Z);

            if (ItemData.IsTranslucent)
            {
                HueVector.Z = 0.5f;
            }

            if (AlphaHue != 255)
            {
                HueVector.Z = 1f - AlphaHue / 255f;
            }

            if (IsCorpse)
            {
                return(DrawCorpse(batcher, posX, posY - 3));
            }


            ushort hue     = Hue;
            ushort graphic = DisplayedGraphic;
            bool   partial = ItemData.IsPartialHue;

            if (OnGround)
            {
                if (ItemData.IsAnimated)
                {
                    if (ProfileManager.CurrentProfile.FieldsType == 2)
                    {
                        if (StaticFilters.IsFireField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0020;
                        }
                        else if (StaticFilters.IsParalyzeField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0058;
                        }
                        else if (StaticFilters.IsEnergyField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0070;
                        }
                        else if (StaticFilters.IsPoisonField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0044;
                        }
                        else if (StaticFilters.IsWallOfStone(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x038A;
                        }
                    }
                }

                if (ItemData.IsContainer && SelectedObject.SelectedContainer == this)
                {
                    hue     = 0x0035;
                    partial = false;
                }
            }

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue = Constants.OUT_RANGE_COLOR;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue = Constants.DEAD_RANGE_COLOR;
            }
            else
            {
                if (!IsLocked && !IsMulti && SelectedObject.LastObject == this)
                {
                    // TODO: check why i put this.
                    //isPartial = ItemData.Weight == 0xFF;
                    hue = 0x0035;
                }
                else if (IsHidden)
                {
                    hue = 0x038E;
                }
            }

            ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, HueVector.Z);

            if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable)
            {
                DrawStaticAnimated
                (
                    batcher,
                    graphic,
                    posX - 5,
                    posY - 5,
                    ref HueVector,
                    ref DrawTransparent,
                    false
                );
            }

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22);
            }

            if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement)
            {
                HueVector.Z = 0.5f;
            }

            DrawStaticAnimated
            (
                batcher,
                graphic,
                posX,
                posY,
                ref HueVector,
                ref DrawTransparent,
                false
            );

            if (SelectedObject.Object == this || TargetManager.TargetingState == CursorTarget.MultiPlacement)
            {
                return(false);
            }

            ArtTexture texture = ArtLoader.Instance.GetTexture(graphic);

            if (texture != null)
            {
                ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (SelectedObject.IsPointInStatic(texture, posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
Example #24
0
        public void TcQZGJ_Layer()
        {
            int    num;
            int    num4;
            object obj2;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Class36.SetFocus(Application.DocumentManager.MdiActiveDocument.Window.Handle);
IL_25:
                num2 = 3;
                DocumentLock documentLock = Application.DocumentManager.MdiActiveDocument.LockDocument();
IL_37:
                num2 = 4;
                CAD.CreateLayer("墙柱小箍筋", 14, "continuous", -3, false, true);
IL_4F:
                num2 = 5;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_5C:
                num2 = 6;
                Database database = mdiActiveDocument.Database;
IL_66:
                num2 = 7;
                TypedValue[] array = new TypedValue[1];
IL_70:
                num2 = 8;
                Array      array2 = array;
                TypedValue typedValue;
                typedValue..ctor(0, "LWPOLYLINE");
                array2.SetValue(typedValue, 0);
IL_8E:
                num2 = 9;
                SelectionFilter selectionFilter = new SelectionFilter(array);
IL_9A:
                num2 = 10;
                PromptSelectionResult selection = mdiActiveDocument.Editor.GetSelection(selectionFilter);
IL_AC:
                num2 = 11;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    SelectionSet value      = selection.Value;
                    IEnumerator  enumerator = value.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        object         obj            = enumerator.Current;
                        SelectedObject selectedObject = (SelectedObject)obj;
                        CAD.ChangeLayer(selectedObject.ObjectId, "墙柱小箍筋");
                    }
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                    transaction.Commit();
                }
IL_130:
                num2 = 13;
                documentLock.Dispose();
IL_139:
                goto IL_1CC;
IL_13E:
                int num3 = num4 + 1;
                num4     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num3);
IL_186:
                goto IL_1C1;
IL_188:
                num4 = num2;
                if (num <= -2)
                {
                    goto IL_13E;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_19E :;
            }
            catch when(endfilter(obj2 is Exception & num != 0 & num4 == 0))
            {
                Exception ex = (Exception)obj3;

                goto IL_188;
            }
IL_1C1:
            throw ProjectData.CreateProjectError(-2146828237);
IL_1CC:
            if (num4 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
Example #25
0
        private void Button2_Click(object sender, EventArgs e)
        {
            int    num;
            int    num4;
            object obj2;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Class36.SetFocus(Application.DocumentManager.MdiActiveDocument.Window.Handle);
IL_25:
                num2 = 3;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_32:
                num2 = 4;
                Database database = mdiActiveDocument.Database;
IL_3B:
                num2 = 5;
                DocumentLock documentLock = Application.DocumentManager.MdiActiveDocument.LockDocument();
IL_4E:
                num2             = 6;
                this.arrayList_0 = new ArrayList();
IL_5B:
                num2 = 7;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "TEXT");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value      = selection.Value;
                        IEnumerator  enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            DBText         dbtext         = (DBText)transaction.GetObject(selectedObject.ObjectId, 1);
                            string         text           = JG.HRB(dbtext.TextString);
                            if ((!this.arrayList_0.Contains(text) & text.Contains("@")) && TcBJFJ_frm.GetBJAS(text) > this.long_0)
                            {
                                this.arrayList_0.Add(text);
                            }
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                    }
                    transaction.Commit();
                }
IL_17C:
                num2 = 9;
                this.TextBox1.Text = "";
IL_18F:
                num2 = 10;
                this.TextBox4.Text = "";
IL_1A2:
                num2             = 11;
                this.arrayList_1 = new ArrayList();
IL_1B0:
                num2 = 12;
                IEnumerator enumerator2 = this.arrayList_0.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    object value2 = enumerator2.Current;
                    string text2  = Conversions.ToString(value2);
IL_1D3:
                    num2 = 13;
                    long bjas = TcBJFJ_frm.GetBJAS(text2);
IL_1DF:
                    num2 = 14;
                    this.arrayList_1.Add(bjas);
IL_1F5:
                    num2 = 15;
                    this.TextBox4.Text = this.TextBox4.Text + Conversions.ToString(bjas) + "\r\n";
IL_21F:
                    num2 = 16;
                    this.TextBox1.Text = this.TextBox1.Text + text2 + "\r\n";
IL_244:
                    num2 = 17;
                }
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
IL_26E:
                num2 = 18;
                this.XGJ_sub();
IL_277:
                num2 = 19;
                if (Information.Err().Number <= 0)
                {
                    goto IL_28E;
                }
IL_289:
                goto IL_3A3;
IL_28E:
                num2 = 22;
IL_291:
                num2 = 23;
                this.Button1.Enabled = true;
IL_2A0:
                num2 = 25;
                documentLock.Dispose();
IL_2AA:
                num2 = 26;
                if (Information.Err().Number <= 0)
                {
                    goto IL_2D1;
                }
IL_2BC:
                num2 = 27;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_2D1:
                goto IL_3A3;
IL_2D6:
                int num3 = num4 + 1;
                num4     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num3);
IL_35A:
                goto IL_398;
IL_35C:
                num4 = num2;
                if (num <= -2)
                {
                    goto IL_2D6;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_375 :;
            }
            catch when(endfilter(obj2 is Exception & num != 0 & num4 == 0))
            {
                Exception ex = (Exception)obj3;

                goto IL_35C;
            }
IL_398:
            throw ProjectData.CreateProjectError(-2146828237);
IL_3A3:
            if (num4 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
        private void MoleculeViewer_MouseMove(object sender, MouseEventArgs e)
        {
            System.Drawing.Point dragPoint  = gscTogoc(e.X, e.Y);
            System.Drawing.Point MousePoint = gscTogoc(e.X, e.Y);
            dragPoint.Offset(dragOffset.X, dragOffset.Y);
            System.Drawing.Size minSize = new System.Drawing.Size(16, 16);
            if (SelectedObject != null)
            {
                if (m_DraggingSelectedObject)
                {
                    Rectangle rect = new System.Drawing.Rectangle(SelectedObject.GetPosition().X, SelectedObject.GetPosition().Y, SelectedObject.Width, SelectedObject.Height);
                    SelectedObject.SetPosition(dragPoint);
                    if (StatusUpdate != null)
                    {
                        StatusUpdate(this, new StatusUpdateEventArgs(StatusUpdateType.ObjectMoved,
                                                                     SelectedObject, String.Format("Object Moved to {0}, {1}", dragPoint.X, dragPoint.Y),
                                                                     dragPoint, 0));
                    }
                    Invalidate();
                }
                else if (m_RotatingSelectedObject)
                {
                    float currentRotation;
                    currentRotation         = (float)AngleToPoint(SelectedObject.GetPosition(), dragPoint);
                    currentRotation         = (float)((int)(currentRotation - startingRotation + originalRotation) % 360);
                    SelectedObject.Rotation = currentRotation;
                    if (StatusUpdate != null)
                    {
                        StatusUpdate(this, new StatusUpdateEventArgs(StatusUpdateType.ObjectRotated,
                                                                     SelectedObject, String.Format("Object Rotated to {0} degrees", currentRotation),
                                                                     new System.Drawing.Point(0, 0), currentRotation));
                    }
                    Invalidate();
                }
                else if (resizing)
                { //combine code because you will need to move ports in both cases
                    System.Drawing.Rectangle rect    = new System.Drawing.Rectangle(SelectedObject.X, SelectedObject.Y, SelectedObject.Width, SelectedObject.Height);
                    System.Drawing.Size      sz      = new System.Drawing.Size(0, 0);
                    System.Drawing.Point     fixedPT = new System.Drawing.Point(0, 0);
                    System.Drawing.Point     dragPT  = new System.Drawing.Point(0, 0);
                    SelectedObject.AutoSize = false;
                    switch (sz_direct)
                    {
                    case SizeDirection.Northwest:      //changing all
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        System.Drawing.Point LRHC = new System.Drawing.Point(0, 0);
                        sz        = SelectedObject.GetSize();
                        LRHC.X    = ULHC.X + sz.Width;
                        LRHC.Y    = ULHC.Y + sz.Height;
                        sz.Width  = LRHC.X - MousePoint.X;
                        sz.Height = LRHC.Y - MousePoint.Y;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        ULHC.X = LRHC.X - sz.Width;
                        ULHC.Y = LRHC.Y - sz.Height;
                        SelectedObject.SetPosition(ULHC);
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.North:    //changing top, and height
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        System.Drawing.Point LLHC = new System.Drawing.Point(0, 0);
                        LLHC.X    = ULHC.X;
                        sz        = SelectedObject.GetSize();
                        LLHC.Y    = ULHC.Y + sz.Height;
                        sz.Height = LLHC.Y - MousePoint.Y;
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        ULHC.Y = LLHC.Y - sz.Height;
                        SelectedObject.SetPosition(ULHC);
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.Northeast:    //changing top, width, and height
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        System.Drawing.Point LLHC = new System.Drawing.Point(0, 0);
                        sz        = SelectedObject.GetSize();
                        LLHC.X    = ULHC.X;
                        LLHC.Y    = ULHC.Y + sz.Height;
                        sz.Width  = MousePoint.X - LLHC.X;
                        sz.Height = LLHC.Y - MousePoint.Y;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        ULHC.X = LLHC.X;
                        ULHC.Y = LLHC.Y - sz.Height;
                        SelectedObject.SetPosition(ULHC);
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.East:     //changing width
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        sz       = SelectedObject.GetSize();
                        sz.Width = MousePoint.X - ULHC.X;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.Southeast:      //changing height, width
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        sz        = SelectedObject.GetSize();
                        sz.Width  = MousePoint.X - ULHC.X;
                        sz.Height = MousePoint.Y - ULHC.Y;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.South:    //changing height
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        sz        = SelectedObject.GetSize();
                        sz.Height = MousePoint.Y - ULHC.Y;
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.Southwest:      //changing left,height, and width
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        System.Drawing.Point URHC = new System.Drawing.Point(0, 0);
                        sz        = SelectedObject.GetSize();
                        URHC.Y    = ULHC.Y;
                        URHC.X    = ULHC.X + sz.Width;
                        sz.Width  = URHC.X - MousePoint.X;
                        sz.Height = MousePoint.Y - URHC.Y;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        if (sz.Height < 16)
                        {
                            sz.Height = 16;
                        }
                        ULHC.X = URHC.X - sz.Width;
                        SelectedObject.SetPosition(ULHC);
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    case SizeDirection.West:    //changing left and width
                    {
                        System.Drawing.Point ULHC = SelectedObject.GetPosition();
                        System.Drawing.Point URHC = new System.Drawing.Point(0, 0);
                        sz       = SelectedObject.GetSize();
                        URHC.Y   = ULHC.Y;
                        URHC.X   = ULHC.X + sz.Width;
                        sz.Width = URHC.X - MousePoint.X;
                        if (sz.Width < 16)
                        {
                            sz.Width = 16;
                        }
                        ULHC.X = URHC.X - sz.Width;
                        SelectedObject.SetPosition(ULHC);
                        SelectedObject.SetSize(sz);
                        break;
                    }

                    default:
                        break;
                    }
                }
            }
            //else if (this.GetDrawingLine())
            //{
            //    //this.Cursor = Cursors.Cross;
            //    System.Drawing.Point points[] = this.GetDrawingLinePoints();
            //    points[points.Length - 1] = gscTogoc(e.X, e.Y);
            //    this.SetDrawingLinePoints(points);
            //    this.Invalidate();
            //}
            else if (m_SelectionDragging)
            {
                m_SelectionRectangle.Width  = e.X - m_SelectionRectangle.X;
                m_SelectionRectangle.Height = e.Y - m_SelectionRectangle.Y;
            }
            else if (m_RotatingSurface)
            {
                surfaceRotation = surfaceRotation + (float)AngleToPoint(dragOffset, dragPoint) / 100;
                //currentRotation = ((int)(currentRotation - startingRotation + originalRotation) % 360);
                if (StatusUpdate != null)
                {
                    StatusUpdate(this, new StatusUpdateEventArgs(StatusUpdateType.ObjectRotated,
                                                                 SelectedObject, String.Format("Surface Rotated to {0} degrees", surfaceRotation),
                                                                 new System.Drawing.Point(0, 0), surfaceRotation));
                }
                Invalidate();
            }
            Invalidate();
        }
Example #27
0
    public override void OnInspectorGUI()
    {
        NGUIEditorTools.SetLabelWidth(120f);
        UIPlayAnimation pa = target as UIPlayAnimation;

        GUILayout.Space(6f);

        GUI.changed = false;

#if USE_MECANIM
        EditorGUI.BeginDisabledGroup(pa.target);
        Animator animator = (Animator)EditorGUILayout.ObjectField("Animator", pa.animator, typeof(Animator), true);
        EditorGUI.EndDisabledGroup();
        EditorGUI.BeginDisabledGroup(pa.animator);
#endif
        Animation anim = (Animation)EditorGUILayout.ObjectField("Animation", pa.target, typeof(Animation), true);

#if USE_MECANIM
        EditorGUI.EndDisabledGroup();
        EditorGUI.BeginDisabledGroup(anim == null && animator == null);
        string clipName = EditorGUILayout.TextField("State Name", pa.clipName);
#else
        EditorGUI.BeginDisabledGroup(anim == null);
        string clipName = EditorGUILayout.TextField("Clip Name", pa.clipName);
#endif

        AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", pa.trigger);

#if USE_MECANIM
        EditorGUI.BeginDisabledGroup(animator != null && !string.IsNullOrEmpty(clipName));
        AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", pa.playDirection);
        EditorGUI.EndDisabledGroup();
#else
        AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", pa.playDirection);
#endif

        SelectedObject so    = pa.clearSelection ? SelectedObject.SetToNothing : SelectedObject.KeepCurrent;
        bool           clear = (SelectedObject)EditorGUILayout.EnumPopup("Selected object", so) == SelectedObject.SetToNothing;
        AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If disabled on start", pa.ifDisabledOnPlay);
        ResetOnPlay rs    = pa.resetOnPlay ? ResetOnPlay.StartFromBeginning : ResetOnPlay.Continue;
        bool        reset = (ResetOnPlay)EditorGUILayout.EnumPopup("If already playing", rs) == ResetOnPlay.StartFromBeginning;
        AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", pa.disableWhenFinished);
        EditorGUI.EndDisabledGroup();

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("PlayAnimation Change", pa);
            pa.target = anim;
#if USE_MECANIM
            pa.animator = animator;
#endif
            pa.clipName            = clipName;
            pa.trigger             = trigger;
            pa.playDirection       = dir;
            pa.clearSelection      = clear;
            pa.ifDisabledOnPlay    = enab;
            pa.resetOnPlay         = reset;
            pa.disableWhenFinished = dis;
            UnityEditor.EditorUtility.SetDirty(pa);
        }

        NGUIEditorTools.SetLabelWidth(80f);
        NGUIEditorTools.DrawEvents("On Finished", pa, pa.onFinished);
    }
            private void LoadRaceGrid()
            {
                try {
                    if (SelectedObject.SerializedRaceGridData != null)
                    {
                        RaceGridViewModel.ImportFromPresetData(SelectedObject.SerializedRaceGridData);
                    }
                    else
                    {
                        RaceGridViewModel.LoadingFromOutside = true;

                        var list = SelectedObject.Drivers;
                        RaceGridViewModel.NonfilteredList.Clear();
                        RaceGridViewModel.Mode = BuiltInGridMode.Custom;
                        RaceGridViewModel.ShuffleCandidates = false;

                        RaceGridViewModel.AiLevelFixed          = true;
                        RaceGridViewModel.AiLevelArrangeRandom  = 0;
                        RaceGridViewModel.AiLevelArrangeReverse = false;
                        RaceGridViewModel.AiLevel    = 100;
                        RaceGridViewModel.AiLevelMin = 100;

                        foreach (var driver in list)
                        {
                            if (driver.CarId == null)
                            {
                                continue;
                            }

                            var car = CarsManager.Instance.GetById(driver.CarId);
                            if (car == null)
                            {
                                SelectedObject.AddError(AcErrorType.Data_UserChampionshipCarIsMissing, driver.CarId);
                                continue;
                            }

                            var skin = driver.SkinId == null ? null : car.GetSkinById(driver.SkinId);
                            if (skin == null)
                            {
                                SelectedObject.AddError(AcErrorType.Data_UserChampionshipCarSkinIsMissing, driver.CarId, driver.SkinId);
                            }

                            if (!driver.IsPlayer)
                            {
                                RaceGridViewModel.NonfilteredList.Add(new RaceGridEntry(car)
                                {
                                    CarSkin = skin,
                                    Name    = driver.Name
                                });
                            }
                        }

                        RaceGridViewModel.OpponentsNumber  = RaceGridViewModel.NonfilteredList.Count;
                        RaceGridViewModel.StartingPosition = 0;
                        RaceGridViewModel.FinishLoading();
                    }

                    RaceGridViewModel.PlayerCar       = SelectedObject.PlayerCar;
                    RaceGridViewModel.TrackPitsNumber = SelectedObject.MaxCars;
                } finally {
                    RaceGridViewModel.LoadingFromOutside = false;
                }
            }
Example #29
0
 private void SelectObject(SelectedObject o)
 {
     Selected = o;
     OK();
 }
Example #30
0
        public void fOPEN()
        {
            Editor ed = acApp.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                Utils.Utils.Init();

                Document acDoc   = acApp.DocumentManager.MdiActiveDocument;
                Database acCurDb = acDoc.Database;

                while (true)
                {
                    PromptSelectionOptions options = new PromptSelectionOptions();
                    options.SingleOnly        = true;
                    options.SinglePickInSpace = true;

                    // Request for objects to be selected in the drawing area
                    PromptSelectionResult acSSPrompt = acDoc.Editor.GetSelection(options);

                    // If the prompt status is OK, objects were selected
                    if (acSSPrompt.Status != PromptStatus.OK || acSSPrompt.Status == PromptStatus.Cancel)
                    {
                        Utils.Utils.End(); return;
                    }
                    if (acSSPrompt.Status == PromptStatus.OK)
                    {
                        SelectionSet acSSet = acSSPrompt.Value;

                        // Step through the objects in the selection set
                        SelectedObject acSSObj = acSSet[0];

                        string    layer = "";
                        Extents3d ext;

                        // Check to make sure a valid SelectedObject object was returned
                        if (acSSObj != null)
                        {
                            // Open the selected object for write
                            Entity acEnt = null;
                            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
                            {
                                acEnt = acTrans.GetObject(acSSObj.ObjectId, OpenMode.ForRead) as Entity;
                                acEnt.Unhighlight();
                                acEnt.Highlight();
                                layer = acEnt.Layer;
                                ext   = acEnt.GeometricExtents;
                            }
                            if (layer.Contains("!FDS_MESH"))
                            {
                                PromptKeywordOptions axisOptions = new PromptKeywordOptions("\nChoose opening axis");
                                axisOptions.Keywords.Add("X-axis");
                                axisOptions.Keywords.Add("Y-axis");
                                axisOptions.Keywords.Add("Z-axis");
                                axisOptions.Keywords.Add("All");
                                axisOptions.AllowNone = false;
                                PromptResult axis = ed.GetKeywords(axisOptions);

                                if (axis.Status != PromptStatus.OK || axis.Status == PromptStatus.Cancel)
                                {
                                    Utils.Utils.End(); return;
                                }
                                ;
                                if (axis.Status == PromptStatus.OK)
                                {
                                    if (axis.StringResult == "X-axis")
                                    {
                                        PromptKeywordOptions directionOptions = new PromptKeywordOptions("\nChoose direction");
                                        directionOptions.Keywords.Add("mIn");
                                        directionOptions.Keywords.Add("mAx");
                                        directionOptions.Keywords.Add("Both");
                                        directionOptions.AllowNone = false;
                                        PromptResult direction = ed.GetKeywords(directionOptions);
                                        if (direction.Status != PromptStatus.OK || direction.Status == PromptStatus.Cancel)
                                        {
                                            Utils.Utils.End(); return;
                                        }
                                        ;
                                        if (direction.Status == PromptStatus.OK)
                                        {
                                            if (direction.StringResult == "mIn")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "mAx")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "Both")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                        }
                                    }
                                    else if (axis.StringResult == "Y-axis")
                                    {
                                        PromptKeywordOptions directionOptions = new PromptKeywordOptions("\nChoose direction");
                                        directionOptions.Keywords.Add("mIn");
                                        directionOptions.Keywords.Add("mAx");
                                        directionOptions.Keywords.Add("Both");
                                        directionOptions.AllowNone = false;
                                        PromptResult direction = ed.GetKeywords(directionOptions);
                                        if (direction.Status != PromptStatus.OK || direction.Status == PromptStatus.Cancel)
                                        {
                                            Utils.Utils.End(); return;
                                        }
                                        ;
                                        if (direction.Status == PromptStatus.OK)
                                        {
                                            if (direction.StringResult == "mIn")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "mAx")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "Both")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                        }
                                    }
                                    else if (axis.StringResult == "Z-axis")
                                    {
                                        PromptKeywordOptions directionOptions = new PromptKeywordOptions("\nChoose direction");
                                        directionOptions.Keywords.Add("mIn");
                                        directionOptions.Keywords.Add("mAx");
                                        directionOptions.Keywords.Add("Both");
                                        directionOptions.AllowNone = false;
                                        PromptResult direction = ed.GetKeywords(directionOptions);
                                        if (direction.Status != PromptStatus.OK || direction.Status == PromptStatus.Cancel)
                                        {
                                            Utils.Utils.End(); return;
                                        }
                                        ;
                                        if (direction.Status == PromptStatus.OK)
                                        {
                                            if (direction.StringResult == "mIn")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "mAx")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                            else if (direction.StringResult == "Both")
                                            {
                                                Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), "!FDS_MESH[open]", 1, 1);
                                                Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                            }
                                        }
                                    }
                                    else if (axis.StringResult == "All")
                                    {
                                        Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                        Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);

                                        Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), "!FDS_MESH[open]", 1, 1);
                                        Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);

                                        Utils.Utils.CreateExtrudedSurface(ext.MinPoint, new Point3d(ext.MaxPoint.X, ext.MaxPoint.Y, ext.MinPoint.Z), "!FDS_MESH[open]", 1, 1);
                                        Utils.Utils.CreateExtrudedSurface(new Point3d(ext.MinPoint.X, ext.MinPoint.Y, ext.MaxPoint.Z), ext.MaxPoint, "!FDS_MESH[open]", 1, 1);
                                    }

                                    using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
                                    {
                                        acEnt = acTrans.GetObject(acSSObj.ObjectId, OpenMode.ForRead) as Entity;
                                        acEnt.Unhighlight();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                ed.WriteMessage("Program error: " + e.ToString());
                Utils.Utils.End();
                return;
            }
        }
		//[InlineCode ("$.link.DetailTmpl('#movieDetail',{movie})")] 
		jQueryObject LinkDetailTmpl (SelectedObject<Movie> movie)
		{
			return Observable.Link("DetailTmpl","#movieDetail", movie );
		}
Example #32
0
 protected override void OnSelectedObjectsChanged(EventArgs e)
 {
     base.OnSelectedObjectsChanged(e);
     Text = SelectedObject == null ? string.Empty : SelectedObject.ToString();
 }