示例#1
0
        private void OnMouseDown(UIComponent component, UIMouseEventParameter p)
        {
            VehicleListBoxRow vehicleListBoxRow = component as VehicleListBoxRow;
            bool zoomIn = Input.GetKey(KeyCode.LeftShift) | Input.GetKey(KeyCode.RightShift);

            if ((int)vehicleListBoxRow.VehicleID != 0 && p.buttons == UIMouseButton.Right)
            {
                InstanceID id = new InstanceID();
                id.Vehicle = vehicleListBoxRow.VehicleID;
                ToolsModifierControl.cameraController.SetTarget(id, ToolsModifierControl.cameraController.transform.position, zoomIn);
                DefaultTool.OpenWorldInfoPanel(id, ToolsModifierControl.cameraController.transform.position);
            }
            else
            {
                if (p.buttons != UIMouseButton.Left)
                {
                    return;
                }
                // ISSUE: reference to a compiler-generated field
                if (this.eventRowShiftClick != null && zoomIn)
                {
                    this.PlayClickSound(p.source);
                    // ISSUE: reference to a compiler-generated field
                    this.eventRowShiftClick(component, p);
                    if (vehicleListBoxRow.IsSelected)
                    {
                        return;
                    }
                }
                vehicleListBoxRow.IsSelected = !vehicleListBoxRow.IsSelected;
                this.OnSelectedItemsChanged();
            }
        }
示例#2
0
        public void AddItem(PrefabData data, ushort vehicleID = 0)
        {
            VehicleListBoxRow[] vehicleListBoxRowArray = new VehicleListBoxRow[this._items.Length + 1];
            Array.Copy((Array)this._items, (Array)vehicleListBoxRowArray, this._items.Length);
            VehicleListBoxRow vehicleListBoxRow = this._scrollablePanel.AddUIComponent <VehicleListBoxRow>();

            if ((UnityEngine.Object) this.Font != (UnityEngine.Object)null)
            {
                vehicleListBoxRow.Font = this.Font;
            }
            vehicleListBoxRow.Prefab                   = data;
            vehicleListBoxRow.VehicleID                = vehicleID;
            vehicleListBoxRow.eventMouseDown          += new MouseEventHandler(this.OnMouseDown);
            vehicleListBoxRowArray[this._items.Length] = vehicleListBoxRow;
            this._items = vehicleListBoxRowArray;
        }