// Token: 0x06002228 RID: 8744 RVA: 0x0020A298 File Offset: 0x00208498
    public override void Update(bool eu)
    {
        if (!lookForMarbles)
        {
            UpdateOtherMarbles();
            lookForMarbles = true;
        }
        if (oracle != null && oracle.room != room)
        {
            oracle = null;
        }
        abstractPhysicalObject.destroyOnAbstraction = (oracle != null);
        if (label != null)
        {
            label.setPos = new Vector2?(firstChunk.pos);
            if (label.room != room)
            {
                label.Destroy();
            }
        }
        else
        {
            label = new GlyphLabel(firstChunk.pos, GlyphLabel.RandomString(1, 1, 12842 + (abstractPhysicalObject as MoonPearl.AbstractMoonPearl).number, false));
            room.AddObject(label);
        }
        base.Update(eu);
        float num  = orbitAngle;
        float num2 = orbitSpeed;
        float num3 = orbitDistance;
        float axis = orbitFlattenAngle;
        float num4 = orbitFlattenFac;

        if (room.gravity < 1f && NotCarried)
        {
            Vector2 a = firstChunk.pos;
            if (orbitObj != null)
            {
                int num5   = 0;
                int num6   = 0;
                int number = abstractPhysicalObject.ID.number;
                for (int i = 0; i < otherMarbles.Count; i++)
                {
                    if (otherMarbles[i].orbitObj == orbitObj && otherMarbles[i].NotCarried && Custom.DistLess(otherMarbles[i].firstChunk.pos, orbitObj.firstChunk.pos, otherMarbles[i].orbitDistance * 4f) && otherMarbles[i].orbitCircle == orbitCircle)
                    {
                        num3 += otherMarbles[i].orbitDistance;
                        if (otherMarbles[i].abstractPhysicalObject.ID.number < abstractPhysicalObject.ID.number)
                        {
                            num6++;
                        }
                        num5++;
                        if (otherMarbles[i].abstractPhysicalObject.ID.number < number)
                        {
                            number = otherMarbles[i].abstractPhysicalObject.ID.number;
                            num    = otherMarbles[i].orbitAngle;
                            num2   = otherMarbles[i].orbitSpeed;
                            axis   = otherMarbles[i].orbitFlattenAngle;
                            num4   = otherMarbles[i].orbitFlattenFac;
                        }
                    }
                }
                num3 /= (float)(1 + num5);
                num  += (float)num6 * (360f / (float)(num5 + 1));
                Vector2 a2 = orbitObj.firstChunk.pos;
                if (orbitObj is Oracle && orbitObj.graphicsModule != null)
                {
                    a2 = (orbitObj.graphicsModule as OracleGraphics).halo.Center(1f);
                }
                a = a2 + Custom.FlattenVectorAlongAxis(Custom.DegToVec(num), axis, num4) * num3 * Mathf.Lerp(1f / num4, 1f, 0.5f);
            }
            else if (hoverPos != null)
            {
                a = hoverPos.Value;
            }
            firstChunk.vel *= Custom.LerpMap(firstChunk.vel.magnitude, 1f, 6f, 0.999f, 0.9f);
            firstChunk.vel += Vector2.ClampMagnitude(a - firstChunk.pos, 100f) / 100f * 0.4f * (1f - room.gravity);
        }
        orbitAngle += num2 * ((orbitCircle % 2 != 0) ? -1f : 1f);
    }
示例#2
0
        private void InitializeComponent()
        {
            panel1 = new Panel()
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            var grid = new Grid
            {
                Parent = panel1,
                Width  = 70,
                Margin = new Thickness(0, 1),
            };

            grid.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 3));
            grid.RowDefinitions.Add(new RowDefinition(SizeType.AutoSize));

            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 40));
            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Absolute, 2));
            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 60));

            var lb1 = new Label
            {
                WordWrap = true,
                Text     = "ListBox represents a Windows control to display a list of items. You can use [ListBox] with object items or [ListBox<T>] with items of specified [T] type",
            };

            grid.AddContent(lb1, 0, 0, 3);

            targetListBox = new ListBox <ItemTest>();
            grid.AddContent(targetListBox, 0, 1);
            targetListBox.OnSelectedIndexChanged += ListBoxSelectedIndexChanged;

            Action <GlyphLabel> glyphStyle = x =>
            {
                x.Foreground      = Color.Cyan;
                x.GlyphForeground = Color.Black;
            };

            var stackPanel = new StackPanel(Orientation.Vertical);

            countLabel = new GlyphLabel("Items count: ", "0");
            countLabel.SetStyle(glyphStyle);
            stackPanel.AddContent(countLabel);

            selectedIndexLabel = new GlyphLabel("Selected index: ", "-1");
            selectedIndexLabel.SetStyle(glyphStyle);
            stackPanel.AddContent(selectedIndexLabel);

            formatStringLabel = new GlyphLabel("Format string: ", " {0} ");
            formatStringLabel.SetStyle(glyphStyle);
            stackPanel.AddContent(formatStringLabel);

            addButton = new Button("Add item")
            {
                Margin = new Thickness(0, 1, 0, 0),
            };
            addButton.OnClick += AddButtonClick;
            stackPanel.AddContent(addButton);

            removeButton = new Button("Remove item")
            {
                IsDisabled = true,
                Margin     = new Thickness(0, 1, 0, 0),
            };
            removeButton.OnClick += RemoveButtonClick;
            stackPanel.AddContent(removeButton);

            grid.AddContent(stackPanel, 2, 1);
        }