/* Handle weapon secondary inputs. */
    private void CreateWeaponInputHandler(WeaponItem item, IWeaponLogic logic, BaseWeaponDecorator decorator, bool isLocal)
    {
        switch ((WeaponSecondaryAction)View.WeaponSecondaryAction)
        {
        /* Sniper sights, e.g. Scope on the Sniper Rifle. Aims down a scope texture.
         * Alternatively, it may simply zoom in the screen without adding a scope, and maintaing a crosshair.
         * This is exclusive to snipers with crosshairs. */
        case WeaponSecondaryAction.SniperRifle:
            ZoomInfo zoomInfo = new ZoomInfo((float)this.View.DefaultZoomMultiplier, (float)this.View.MinZoomMultiplier, (float)this.View.MaxZoomMultiplier);
            this.InputHandler = new SniperRifleInputHandler(logic, isLocal, zoomInfo, this.View);
            break;

        /* Iron sights, e.g. ADS on Machine Gun. Basically aims down the physical gun model. */
        case WeaponSecondaryAction.IronSight:
            ZoomInfo zoomInfo2 = new ZoomInfo((float)this.View.DefaultZoomMultiplier, (float)this.View.MinZoomMultiplier, (float)this.View.MaxZoomMultiplier);
            this.InputHandler = new IronsightInputHandler(logic, isLocal, zoomInfo2, this.View);
            break;

        /* Detonation trigger, e.g. The Final World. */
        case WeaponSecondaryAction.ExplosionTrigger:
            Debug.LogError("The ting go skrrt");
            this.InputHandler = new DefaultWeaponInputHandler(logic, isLocal, this.View, new GrenadeExplosionHander());
            break;

        /* Windup time on the weapon, e.g. Battlesnake/Sabertooth. */
        case WeaponSecondaryAction.Minigun:
            this.InputHandler = new MinigunInputHandler(logic, isLocal, decorator as MinigunWeaponDecorator, this.View);
            break;

        /* No secondary action, only Left Click. Think of cannons, most launchers, most splatterguns. */
        default:
            this.InputHandler = new DefaultWeaponInputHandler(logic, isLocal, this.View, null);
            break;
        }
    }
Example #2
0
        public EnhancedCanvas()
        {
            InitializeComponent();

            /* hScrollBar.ValueChanged += OnScrollBarValueChangedX;
             * vScrollBar.ValueChanged += OnScrollBarValueChangedY;
             * hScrollBar.Scroll += ScrollBar_Scroll;
             * vScrollBar.Scroll += ScrollBar_Scroll;
             */
            ECanvas.MouseEnter += ECanvasOnMouseEnter;
            ECanvas.MouseLeave += ECanvasOnMouseLeave;

            // EventSink.ScrollVisibleEvent += EventSink_ScrollVisibleEvent;
            //EventSink.MapChangedEvent += EventSink_MapChangedEvent;
            // Global.FacetChanged += (sender, e) =>
            //{

            /*Map = Global.Maps[e.Current];
             * hScrollBar.Maximum = Map.Width + 9;
             * vScrollBar.Maximum = Map.Height + 9;
             * EventSink.InvokeLocationChanged(new OnLocationChangedEventArgs((int)Global.X, (int)Global.Y));*/
            //};

            // EventSink.LocationChangedEvent += EventSink_LocationChangedEvent;

            Zoom = new ZoomInfo();

            SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
        }
Example #3
0
 public void OnSequenceChange(JSequencer newSequence)
 {
     CurrentSequence = newSequence;
     ZoomInfo.Reset();
     ScrollInfo.Reset();
     totalPixelWidthOfTimeline = 1.0f;
     UpdateCachedMarkerInformation();
     InitializeRenderMapWithSequence();
     SequenceWindow.Repaint();
 }
 void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
 }
Example #5
0
    public CameraOpMgr(TrackballCamera cam, GameObject pickingSkipObj)
    {
        container = cam;
        skipObj   = pickingSkipObj;

        pivotInfo = new PivotInfo();
        zoomInfo  = new ZoomInfo(Vector3.Distance(cam.transform.position, pivotInfo.pivotPos));
        rotInfo   = new RotationInfo();

        InitFSM();
    }
 // Token: 0x06001F11 RID: 7953 RVA: 0x00095EA0 File Offset: 0x000940A0
 public SniperRifleInputHandler(IWeaponLogic logic, bool isLocal, ZoomInfo zoomInfo, UberStrikeItemWeaponView view) : base(logic, isLocal)
 {
     this._zoomInfo = zoomInfo;
     if (view.HasAutomaticFire)
     {
         base.FireHandler = new FullAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
     else
     {
         base.FireHandler = new SemiAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
 }
 // Token: 0x06001F1D RID: 7965 RVA: 0x000963E4 File Offset: 0x000945E4
 protected static void ZoomOut(ZoomInfo zoomInfo, BaseWeaponDecorator weapon)
 {
     LevelCamera.DoZoomOut(75f, 10f);
     UserInput.ZoomSpeed = 1f;
     if (zoomInfo != null)
     {
         zoomInfo.CurrentMultiplier = zoomInfo.DefaultMultiplier;
     }
     if (weapon)
     {
         AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(GameAudio.SniperScopeOut, 0UL);
     }
 }
Example #8
0
 private void cmbZoomPercent_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DocumentViewer1 != null && DocumentViewer1.IsDocumentLoaded && cmbZoomPercent.SelectedIndex != -1)
     {
         ZoomInfo currentZoom = cmbZoomPercent.SelectedItem as ZoomInfo;
         if (currentZoom.ZoomType == ZoomType.Standard)
         {
             DocumentViewer1.Zoom.ZoomMode = currentZoom.ZoomMode;
         }
         else
         {
             DocumentViewer1.Zoom.ZoomPercent = (cmbZoomPercent.SelectedItem as ZoomInfo).Zoom;
         }
     }
 }
Example #9
0
    IEnumerator RefreshPivot()
    {
        while (opMgr.pivotInfo.GetDistanceToMove() >= ZoomInfo.zoomDampening)
        {
            opMgr.pivotInfo.ApproachToPivot(ZoomInfo.zoomDampening);
            transform.LookAt(opMgr.pivotInfo.pivotPos);
            yield return(null);
        }

        float targetDist = opMgr.pivotInfo.GetDistanceToMove();
        float dist       = ZoomInfo.ClampZoomingDistancePerTick(targetDist);

        if (dist > 0.0f)
        {
            opMgr.pivotInfo.ApproachToPivot(dist);
            transform.LookAt(opMgr.pivotInfo.pivotPos);
        }

        opMgr.pivotInfo.Clear();
    }
 // Token: 0x06001F1C RID: 7964 RVA: 0x0009630C File Offset: 0x0009450C
 protected static void ZoomIn(ZoomInfo zoomInfo, BaseWeaponDecorator weapon, float zoom, bool hideWeapon)
 {
     if (weapon)
     {
         if (!LevelCamera.IsZoomedIn)
         {
             AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(GameAudio.SniperScopeIn, 0UL);
         }
         else if (zoom < 0f && zoomInfo.CurrentMultiplier != zoomInfo.MinMultiplier)
         {
             AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(GameAudio.SniperZoomIn, 0UL);
         }
         else if (zoom > 0f && zoomInfo.CurrentMultiplier != zoomInfo.MaxMultiplier)
         {
             AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(GameAudio.SniperZoomOut, 0UL);
         }
         zoomInfo.CurrentMultiplier = Mathf.Clamp(zoomInfo.CurrentMultiplier + zoom, zoomInfo.MinMultiplier, zoomInfo.MaxMultiplier);
         LevelCamera.DoZoomIn(75f / zoomInfo.CurrentMultiplier, 20f, hideWeapon);
         UserInput.ZoomSpeed = 0.5f;
     }
 }
Example #11
0
        private void OnEnable()
        {
            hideFlags     = HideFlags.HideAndDontSave;
            FloatingWidth = BaseFloatingWidth + additionalFloatingWidth;

            if (ScrollInfo == null)
            {
                ScrollInfo = CreateInstance <USScrollInfo>();
                ScrollInfo.Reset();
            }
            if (ZoomInfo == null)
            {
                ZoomInfo = CreateInstance <USZoomInfo>();
                ZoomInfo.Reset();
            }

            if (CurrentSequence)
            {
                UpdateCachedMarkerInformation();
            }
        }
Example #12
0
        public void OnSequenceChange(USSequencer newSequence)
        {
            CurrentSequence = newSequence;
            ZoomInfo.Reset();
            ScrollInfo.Reset();
            totalPixelWidthOfTimeline = 1.0f;
            UpdateCachedMarkerInformation();

            if (USHierarchy == null)
            {
                USHierarchy = CreateInstance(typeof(USHierarchy)) as USHierarchy;
            }

            foreach (var newTimelineContainer in CurrentSequence.TimelineContainers)
            {
                var newHierarchyItem = CreateInstance(typeof(USTimelineContainerHierarchyItem)) as USTimelineContainerHierarchyItem;
                newHierarchyItem.SetupWithTimelineContainer(newTimelineContainer);
                USHierarchy.AddHierarchyItemToRoot(newHierarchyItem as IUSHierarchyItem);
            }

            SequenceWindow.Repaint();
        }
Example #13
0
        private void OnEnable()
        {
            hideFlags = HideFlags.HideAndDontSave;

            if (ScrollInfo == null)
            {
                ScrollInfo = ScriptableObject.CreateInstance <JScrollInfo>();
                ScrollInfo.Reset();
            }
            if (ZoomInfo == null)
            {
                ZoomInfo = ScriptableObject.CreateInstance <JZoomInfo>();
                ZoomInfo.Reset();
            }
            if (currentSequence)
            {
                UpdateCachedMarkerInformation();
            }
            if (currentSequence)
            {
                InitializeRenderMapWithSequence();
            }
        }
Example #14
0
        /// <summary>
        /// Returns the <see cref="Location"/> parameter or an updated
        /// one if the zoom level is invalid for the <see cref="Display"/>
        /// </summary>
        private Location ValidateZoom(ZoomInfo zoom, Location location)
        {
            if (location.Zoom < zoom.Minimum)
            {
                return(new Location(location.Display, location.Point, zoom.Minimum));
            }
            if (location.Zoom > zoom.Maximum)
            {
                // Swap to Shape/Icon
                // If this changes also check the hack in Map.GetSpan
                if (location.Display == DisplayTypes.Icon)
                {
                    return(new Location(DisplayTypes.Shape, location.Point, IconDrawerFactory.MinVillageSide));
                }
                if (location.Display == DisplayTypes.Shape)
                {
                    return(new Location(DisplayTypes.Icon, location.Point, IconDrawerFactory.AutoSwitchFromShapeIndex));
                }

                return(new Location(location.Display, location.Point, zoom.Maximum));
            }
            return(location);
        }
Example #15
0
        public Display(DisplaySettings settings, bool isMiniMap, Map map, ref Location location)
            : this(settings, map)
        {
            // Validate zoom or we have a potential divide by zero etc
            if (isMiniMap)
            {
                ZoomInfo zoom = DrawerFactoryBase.CreateMiniMapZoom(location.Zoom);
                location = zoom.Validate(location);

                _drawerFactoryStrategy = DrawerFactoryBase.CreateMiniMap(location.Zoom);
            }
            else
            {
                ZoomInfo zoom = DrawerFactoryBase.CreateZoom(location.Display, location.Zoom);
                location = ValidateZoom(zoom, location);

                _drawerFactoryStrategy = DrawerFactoryBase.Create(location.Display, location.Zoom, settings.Scenery);
            }

            // TODO: make this lazy. Setting here = crash
            // Is fixed by calling UpdateLocation after Map.Location is set
            //_visibleRectangle = GetGameRectangle();
        }
Example #16
0
        internal static bool IsZoomInfoModified(CameraStatus status, ZoomInfo latest)
        {
            if (latest == null)
            {
                return false;
            }
            var previous = status.ZoomInfo;
            status.ZoomInfo = latest;

            return previous == null ||
                previous.current_box_index != latest.current_box_index ||
                previous.number_of_boxes != latest.number_of_boxes ||
                previous.position != latest.position ||
                previous.position_in_current_box != latest.position_in_current_box;
        }
Example #17
0
        internal static void GetEvent(string jString, Action<int> error, GetEventHandler result)
        {
            var json = JObject.Parse(jString);
            if (BasicResultHandler.HandleError(json, error))
            {
                return;
            }

            var jResult = json["result"];

            var jApi = jResult[0];
            string[] apis = null;
            if (jApi.HasValues)
            {
                var apilist = new List<string>();
                foreach (var str in jApi["names"].Values<string>())
                {
                    apilist.Add(str);
                }
                apis = apilist.ToArray();
            }

            var jStatus = jResult[1];
            string status = null;
            if (jStatus.HasValues)
            {
                status = jStatus.Value<string>("cameraStatus");
            }

            var jZoom = jResult[2];
            ZoomInfo zoom = null;
            if (jZoom.HasValues)
            {
                zoom = new ZoomInfo
                {
                    position = jZoom.Value<int>("zoomPosition"),
                    number_of_boxes = jZoom.Value<int>("zoomNumberBox"),
                    current_box_index = jZoom.Value<int>("zoomIndexCurrentBox"),
                    position_in_current_box = jZoom.Value<int>("zoomPositionCurrentBox")
                };
            }

            var jLiveview = jResult[3];
            bool liveview_status = false;
            if (jLiveview.HasValues)
            {
                jLiveview.Value<bool>("liveviewStatus");
            }

            var jExposureMode = jResult[18];
            BasicInfo<string> exposure = null;
            if (jExposureMode.HasValues)
            {
                var modecandidates = new List<string>();
                foreach (var str in jExposureMode["exposureModeCandidates"].Values<string>())
                {
                    modecandidates.Add(str);
                }
                exposure = new BasicInfo<string>
                {
                    current = jExposureMode.Value<string>("currentExposureMode"),
                    candidates = modecandidates.ToArray()
                };
            }

            var jPostView = jResult[19];
            BasicInfo<string> postview = null;
            if (jPostView.HasValues)
            {
                var pvcandidates = new List<string>();
                foreach (var str in jPostView["postviewImageSizeCandidates"].Values<string>())
                {
                    pvcandidates.Add(str);
                }
                postview = new BasicInfo<string>
                {
                    current = jPostView.Value<string>("currentPostviewImageSize"),
                    candidates = pvcandidates.ToArray()
                };
            }

            var jSelfTimer = jResult[20];
            BasicInfo<int> selftimer = null;
            if (jSelfTimer.HasValues)
            {
                var stcandidates = new List<int>();
                foreach (var str in jSelfTimer["selfTimerCandidates"].Values<int>())
                {
                    stcandidates.Add(str);
                }
                selftimer = new BasicInfo<int>
                {
                    current = jSelfTimer.Value<int>("currentSelfTimer"),
                    candidates = stcandidates.ToArray()
                };
            }

            var jShootMode = jResult[21];
            BasicInfo<string> shootmode = null;
            if (jShootMode.HasValues)
            {
                var smcandidates = new List<string>();
                foreach (var str in jShootMode["shootModeCandidates"].Values<string>())
                {
                    smcandidates.Add(str);
                }
                shootmode = new BasicInfo<string>
                {
                    current = jShootMode.Value<string>("currentShootMode"),
                    candidates = smcandidates.ToArray()
                };
            }

            var jEV = jResult[25];
            EvInfo ev = null;
            if (jEV.HasValues)
            {
                ev = new EvInfo
                {
                    MaxIndex = jEV.Value<int>("maxExposureCompensation"),
                    MinIndex = jEV.Value<int>("minExposureCompensation"),
                    CurrentIndex = jEV.Value<int>("currentExposureCompensation"),
                    StepDefinition = jEV.Value<int>("stepIndexOfExposureCompensation")
                };
            }

            var jFN = jResult[27];
            BasicInfo<string> fn = null;
            if (jFN.HasValues)
            {
                var fncandidates = new List<string>();
                foreach (var str in jFN["fNumberCandidates"].Values<string>())
                {
                    fncandidates.Add(str);
                }
                fn = new BasicInfo<string>
                {
                    current = jFN.Value<string>("currentFNumber"),
                    candidates = fncandidates.ToArray()
                };
            }

            var jIso = jResult[29];
            BasicInfo<string> iso = null;
            if (jIso.HasValues)
            {
                var isocandidates = new List<string>();
                foreach (var str in jIso["isoSpeedRateCandidates"].Values<string>())
                {
                    isocandidates.Add(str);
                }
                iso = new BasicInfo<string>
                {
                    current = jIso.Value<string>("currentIsoSpeedRate"),
                    candidates = isocandidates.ToArray()
                };
            }

            var jPS = jResult[31];
            bool? ps = null;
            if (jPS.HasValues)
            {
                ps = jPS.Value<bool>("isShifted");
            }

            var jSS = jResult[32];
            BasicInfo<string> ss = null;
            if (jSS.HasValues)
            {
                var sscandidates = new List<string>();
                foreach (var str in jSS["shutterSpeedCandidates"].Values<string>())
                {
                    sscandidates.Add(str);
                }
                ss = new BasicInfo<string>
                {
                    current = jSS.Value<string>("currentShutterSpeed"),
                    candidates = sscandidates.ToArray()
                };
            }

            result.Invoke(new Event()
            {
                AvailableApis = apis,
                CameraStatus = status,
                ZoomInfo = zoom,
                LiveviewAvailable = liveview_status,
                PostviewSizeInfo = postview,
                SelfTimerInfo = selftimer,
                ShootModeInfo = shootmode,
                FNumber = fn,
                ISOSpeedRate = iso,
                ShutterSpeed = ss,
                EvInfo = ev,
                ExposureMode = exposure,
                ProgramShiftActivated = ps
            });
        }
Example #18
0
 public void InitEventParams()
 {
     ProgramShiftActivated = false;
     EvInfo = null;
     ISOSpeedRate = null;
     ShutterSpeed = null;
     ExposureMode = null;
     ShootModeInfo = null;
     SelfTimerInfo = null;
     PostviewSizeInfo = null;
     IsLiveviewAvailable = false;
     ZoomInfo = null;
     Status = ApiParams.EventNotReady;
     AvailableApis = null;
 }
Example #19
0
        public override void GeneratePads(GeneratePadArgs args)
        {
            base.GeneratePads(args);
            if (Document.EditMode)
            {
                var canEdit = Client == null || Client.CurrentUser.Level >= Pablo.Network.UserLevel.Editor;
                if (canEdit)
                {
                    var layout = new TableLayout
                    {
                        Padding = new Padding(5),
                        Rows    =
                        {
                            new Controls.ColourPad(this),
                            new Controls.ToolboxPad(this)
                        }
                    };
                    args.LeftPads.Add(layout);
                }

                {
                    var layout = new DynamicLayout {
                        Padding = Padding.Empty, Spacing = Size.Empty
                    };

                    layout.BeginHorizontal();
                    if (canEdit)
                    {
                        layout.Add(new Controls.CharacterPad(this));
                    }
                    layout.Add(new Controls.FlagsPad(this), xscale: true);
                    layout.Add(new Controls.PositionPad(this));
                    layout.EndHorizontal();

                    args.BottomPads.Add(layout);
                }


                /* VGA Preview
                 */
                if (preview == null)
                {
                    preview = new CharacterHandler(CharacterDocument, false);
                    preview.AllowToolSelection = false;
                    var v  = (ViewerPane)preview.ViewerControl;
                    var zi = new ZoomInfo {
                        Zoom = 0.25F, FitWidth = true
                    };
                    v.ZoomInfo = zi;
                    preview.ViewerControl.ID = "preview";

                    /*CurrentPage.Canvas.Update += delegate(object sender, Rectangle rect) {
                     *      h2.InvalidateCharacterRegion (rect);
                     * };*/
                    CurrentPage.Canvas.SizeChanged += preview.document_SizeChanged;

                    // must be after creating the viewer
                    preview.PreLoad(null, null);
                    preview.Loaded();
                    preview.PostLoad();
                }

                var dl = new Panel {
                    Size = new Size(165, 100), Padding = new Padding(5, 0, 0, 0), Content = preview.ViewerControl
                };
                args.RightPads.Add(dl);
                /**/
            }
        }
Example #20
0
 public MapLocationEventArgs(Location newLocation, Location oldLocation, ZoomInfo zoom)
 {
     NewLocation = newLocation;
     OldLocation = oldLocation;
     ZoomInfo    = zoom;
 }