コード例 #1
0
    public void SetPointerState(Lens pointerState)
    {
        this.pointerState = pointerState;
        tooltipTitle.text = "";
        tooltipText.text  = "";

        string cancelText = (touchMode ? "Tap " : "Click ") + "outside to cancel";

        switch (pointerState)
        {
        case Lens.Road:
            tooltipTitle.text = "Place roads";
            tooltipText.text  = cancelText;
            break;

        case Lens.Residential:
            tooltipTitle.text = "Assign residential tiles";
            tooltipText.text  = cancelText;
            break;

        case Lens.Industrial:
            tooltipTitle.text = "Assign workplace tiles";
            tooltipText.text  = cancelText;
            break;

        case Lens.Erase:
            tooltipTitle.text = "Erase residential/workplace tiles";
            tooltipText.text  = cancelText;
            break;
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: ooglykraken/Katabasis
    public void Awake()
    {
        playerScale = transform.localScale;
        hasFloorKey = false;

        lens    = Lens.Instance();
        laser   = Laser.Instance();
        lantern = transform.Find("Lantern").gameObject;
        sprite  = transform.Find("Sprite").gameObject.GetComponent <SpriteRenderer>();

        startingLightRange = lantern.GetComponent <Light>().range;

        playerAnimator = transform.Find("Animator").gameObject.GetComponent <Animator>();

        position = transform;


        horizontalBeltModifier = 0f;
        verticalBeltModifier   = 0f;

        isTeleporting = false;
        isFiringLaser = false;
        grounded      = false;

        if (Gameplay.Instance().spawnLocation != null)
        {
            teleportLocation = Gameplay.Instance().spawnLocation.position;
        }
    }
コード例 #3
0
 public LensToken AddLens(Lens <T> lens)
 {
     lenses.Add(lens);
     return(new LensToken(
                () => lenses.Remove(lens)
                ));
 }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     blurComponent = GetComponent<UnityStandardAssets.ImageEffects.Blur> ();
     lenses = new Lens[2];
     lenses[0] = new Lens(1);
     lenses[1] = new Lens(2);
 }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Manufacturer,Model,Aperture,Min_focal_length,Max_focal_length,Mounting_id")] Lens lens)
        {
            if (id != lens.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lens);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LensExists(lens.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lens));
        }
コード例 #6
0
        static ThingLens()
        {
            Id = Lens.Create <Thing, long>(
                thing => thing.Id,
                id => thing => thing.With(id: id));

            ThingType = Lens.Create <Thing, ThingTypes>(
                thing => thing.ThingType,
                thingType => thing => thing.With(thingType: thingType));

            Name = Lens.Create <Thing, string>(
                thing => thing.Name,
                name => thing => thing.With(name: name));

            ValidSlots = Lens.Create <Thing, ISlotList>(
                thing => thing.ValidSlots,
                validSlots => thing => thing.With(validSlots: validSlots));

            EquipableAs = Lens.Create <Thing, IMaybe <EquipmentSlots> >(
                thing => thing.EquipedAs,
                equipedAs => thing => thing.With(equipedAs: equipedAs));

            CombatStatistics = Lens.Create <Thing, IMaybe <CombatStatistics> >(
                thing => thing.CombatStatistics,
                combatStatistics => thing => thing.With(combatStatistics: combatStatistics));

            Contains = Lens.Create <Thing, IThingStore>(
                thing => thing.Contains,
                contains => thing => thing.With(contains: contains));
        }
        private static void CreateLensesIfNotExist(PhotographyContext context, IEnumerable <XElement> xLenses, Manufacturer manufacturer)
        {
            foreach (var xLens in xLenses)
            {
                var lensModel = xLens.Attribute("model").Value;
                var lensType  = xLens.Attribute("type").Value;
                var lensPrice = xLens.Attribute("price");

                var lens = context.Lenses.FirstOrDefault(x => x.Model == lensModel);
                if (lens != null)
                {
                    Console.WriteLine("Existing lens: {0}", lensModel);
                }
                else
                {
                    lens = new Lens
                    {
                        Model = lensModel,
                        Type  = lensType,
                        Price = lensPrice != null?decimal.Parse(lensPrice.Value) : default(decimal?),
                                    ManufacturerId = manufacturer.Id
                    };

                    context.Lenses.Add(lens);
                    context.SaveChanges();
                    Console.WriteLine("Created lens: {0}", lensModel);
                }
            }
        }
コード例 #8
0
        public static void ImportLenses()
        {
            IEnumerable <LensDto> lensesDto = ParseJson <LensDto>(Constants.LensPath);
            List <Lens>           lenses    = new List <Lens>();

            using (PhotographyWorkshopContext context = new PhotographyWorkshopContext())
            {
                foreach (LensDto lensDto in lensesDto)
                {
                    Lens lensEntity = new Lens()
                    {
                        Make           = lensDto.Make,
                        FocalLength    = int.Parse(lensDto.FocalLength),
                        MaxAperture    = float.Parse(lensDto.MaxAperture),
                        CompatibleWith = lensDto.CompatibleWith
                    };

                    lenses.Add(lensEntity);
                    Console.WriteLine($"Successfully imported {lensEntity.Make} {lensEntity.FocalLength}mm f{lensEntity.MaxAperture}");
                }

                context.Lenses.AddRange(lenses);
                context.SaveChanges();
            }
        }
コード例 #9
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Lens l;
         if (dataLens.SelectedRows.Count == 0)
         {
             MessageBoxes.Info("No item(s) selected.\nPlease select an item to delete.");
         }
         else
         {
             string warningMessage = "Are you sure want to delete " + dataLens.SelectedRows.Count + "Item(s)?\nThis action can't be overturned.";
             if (MessageBoxes.Warning(warningMessage) == true)
             {
                 foreach (DataGridViewRow row in dataLens.SelectedRows)
                 {
                     int id = (int)row.Cells[0].Value;
                     l = new Lens(id);
                     l.Delete();
                 }
                 Reset();
                 dataLens.Refresh();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxes.Error(ex.Message);
     }
 }
コード例 #10
0
ファイル: CameraState.cs プロジェクト: viewsat/GMaster
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Battery?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Cammode?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ RemainCapacity;
         hashCode = (hashCode * 397) ^ (int)SdCardStatus;
         hashCode = (hashCode * 397) ^ (int)SdMemory;
         hashCode = (hashCode * 397) ^ VideoRemainCapacity;
         hashCode = (hashCode * 397) ^ (int)Rec;
         hashCode = (hashCode * 397) ^ (BurstIntervalStatus?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)SdAccess;
         hashCode = (hashCode * 397) ^ (int)RemainDisplayType;
         hashCode = (hashCode * 397) ^ ProgressTime;
         hashCode = (hashCode * 397) ^ (Operate?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ StopMotionNum;
         hashCode = (hashCode * 397) ^ (int)StopMotion;
         hashCode = (hashCode * 397) ^ (Temperature?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Lens?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)AddLocationData;
         hashCode = (hashCode * 397) ^ (int)IntervalStatus;
         hashCode = (hashCode * 397) ^ (SdiState?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (WarnDisp?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Version?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
コード例 #11
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Camera {");
            sb.AppendLine(Lens.ToString());
            sb.AppendFormat("  Focus plane Z: {0},", FocusZ);
            sb.AppendLine();
            sb.AppendFormat("  Sensor center Z: {0},", SensorZ);
            sb.AppendLine();
            sb.AppendFormat("  Sensor tilt: {0},", SensorRotation);
            sb.AppendLine();
            sb.AppendFormat("  Sensor shift: {0},", SensorShift2);
            sb.AppendLine();
            sb.AppendFormat("  Sensor size: {0},", SensorSize);
            sb.AppendLine();
            sb.AppendFormat("  Near: {0}, Far: {1},", Near, Far);
            sb.AppendLine();
            sb.AppendFormat("  Field of view: {0},", FieldOfView);
            sb.AppendLine();
            sb.AppendFormat("  Aspect ratio: {0}", AspectRatio);
            sb.AppendLine();
            sb.AppendLine("}");
            return(sb.ToString());
        }
コード例 #12
0
        private static void ImportLenses(PhotographyWorkshopsContext context)
        {
            string json       = File.ReadAllText(LensesPath);
            var    lensesDtos = JsonConvert.DeserializeObject <IEnumerable <LensDto> >(json);

            foreach (var lensesDto in lensesDtos)
            {
                if (lensesDto.Make == null || lensesDto.FocalLength == 0 || lensesDto.MaxAperture == 0 || lensesDto.CompatibleWith == null)
                {
                    Console.WriteLine(Error);
                    continue;
                }

                Lens lens = new Lens()
                {
                    Make           = lensesDto.Make,
                    FocalLength    = lensesDto.FocalLength,
                    MaxAperture    = lensesDto.MaxAperture,
                    CompatibleWith = lensesDto.CompatibleWith
                };

                context.Lenses.Add(lens);
                Console.WriteLine($"Successfully imported {lens.Make} {lens.FocalLength}mm f{lens.MaxAperture}");
            }

            context.SaveChanges();
        }
コード例 #13
0
    void FindComponents()
    {
        ScreenOverlayScript = Camera.main.GetComponent <ScreenOverlay> ();

        // Finds the rigidbody this script is attached to.
        rb = GetComponent <Rigidbody> ();

        // Finds Game Controller script.
        gameControllerScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ();

        // Finds Player Mesh Collider (note collider and mesh comonents are two different GameObjects).
        PlayerCollider = GameObject.Find("Collider").GetComponent <MeshCollider>();

        // Finds Player Mesh Renderer
        if (isClone == false)
        {
            PlayerMesh = GameObject.FindGameObjectWithTag("PlayerMesh").GetComponent <MeshRenderer> ();
        }

        // Timescale controller script.
        timeScaleControllerScript = GameObject.FindGameObjectWithTag("TimeScaleController").GetComponent <TimescaleController> ();

        // Finds color correction curves script.
        ColorCorrectionCurvesScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ColorCorrectionCurves>();

        // Finds Camera Shake script.
        if (GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> ().enabled == true && isClone == false)
        {
            camShakeScrpt = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake> ();
            LensScript    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Lens> ();
        }

        Shafts = GameObject.FindGameObjectWithTag("Shafts");
    }
コード例 #14
0
        public void DeleteLens(int id)
        {
            Lens lens = db.Lenses.Find(id);

            db.Lenses.Remove(lens);
            db.SaveChanges();
        }
コード例 #15
0
        private static void CreateLensIfNotExists(
            PhotographyEntities context,
            IEnumerable <XElement> xLenses,
            Manufacturer manufacturer)
        {
            foreach (var xLense in xLenses)
            {
                // Find the lens by model and type (if exists)
                var lenseModel = xLense.Attribute("model").Value;
                var lenseType  = xLense.Attribute("type").Value;
                var lensePrice = xLense.Attribute("price");

                var lens = context.Lenses.FirstOrDefault(l => l.Model == lenseModel);
                if (lens != null)
                {
                    Console.WriteLine($"Existing lens: {lenseModel}");
                }
                else
                {
                    lens = new Lens
                    {
                        Model = lenseModel,
                        Type  = lenseType,
                        Price = lensePrice != null?decimal.Parse(lensePrice.Value) : default(decimal?),
                                    ManufacturerId = manufacturer.Id
                    };

                    context.Lenses.Add(lens);
                    context.SaveChanges();
                    Console.WriteLine("Created lens: {0}", lenseModel);
                }
            }
        }
コード例 #16
0
        public LabelPanel()
        {
            InitializeComponent();

            _labelLens             = new Lens <Dto.Label, TriStateToggle>(DataClient.Label.Get(), TriStateToggle.Create);
            label_list.ItemsSource = _labelLens.GetSink;
        }
コード例 #17
0
        public void Reset()
        {
            txtDescription.Text  = prescriptionGlasses.ProductDescription;
            txtFrameColor.Text   = prescriptionGlasses.FrameColor;
            txtName.Text         = prescriptionGlasses.Name;
            txtPrice.Text        = decimal.Round(prescriptionGlasses.Price).ToString();
            txtProductId.Text    = "" + prescriptionGlasses.id;
            numDiscount.Value    = prescriptionGlasses.Discount;
            numQuantity.Value    = prescriptionGlasses.Quantity;
            chkStopOrder.Checked = prescriptionGlasses.StopOrder;
            BindingSource imagesBinding = new BindingSource();

            imagesBinding.DataSource          = lstIVM;
            imageGridView.DataSource          = imagesBinding;
            imageGridView.Columns[0].Visible  = false;
            imageGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            BindingSource frameBinding = new BindingSource();
            BindingSource lensBinding  = new BindingSource();

            frameBinding.DataSource   = Frame.GetAllFrames();
            lensBinding.DataSource    = Lens.GetAllLenses();
            comboFrames.DataSource    = frameBinding;
            comboFrames.DisplayMember = "FrameName";
            comboFrames.ValueMember   = "FrameId";
            comboFrames.Text          = prescriptionGlasses.Frame.FrameName;
            comboLens.DataSource      = lensBinding;
            comboLens.DisplayMember   = "LensName";
            comboLens.ValueMember     = "LensId";
            comboLens.Text            = prescriptionGlasses.Lens.LensName;
        }
コード例 #18
0
        static ActorLens()
        {
            Id = Lens.Create <Actor, long>(
                actor => actor.Id,
                id => actor => actor.With(id: id));

            ActorType = Lens.Create <Actor, ActorTypes>(
                actor => actor.ActorType,
                actorType => actor => actor.With(actorType: actorType));

            Name = Lens.Create <Actor, string>(
                actor => actor.Name,
                name => actor => actor.With(name: name));

            Statistics = Lens.Create <Actor, IStatisticsStore>(
                actor => actor.Statistics,
                statistics => actor => actor.With(statistics: statistics));

            HitPoints = Lens.Create <Actor, HitPoints>(
                actor => actor.HitPoints,
                hitPoints => actor => actor.With(hitPoints: hitPoints));

            Things = Lens.Create <Actor, IThingStore>(
                actor => actor.Things,
                things => actor => actor.With(things: things));
        }
        private static void ImportLensesFromJSON(PhotographyWorkshopsContext context)
        {
            var json   = File.ReadAllText(ImportLensesPath);
            var lenses = JsonConvert.DeserializeObject <IEnumerable <LensDTO> >(json);

            foreach (var lens in lenses)
            {
                if ((lens.Make == null) ||
                    (lens.FocalLength == null) ||
                    (lens.MaxAperture == null) ||
                    (lens.CompatibleWith == null))
                {
                    Console.WriteLine("Error. Invalid data provided");
                    continue;
                }

                var lensEntity = new Lens()
                {
                    Make           = lens.Make,
                    FocalLength    = IfNoIntValueReturnNull(lens.FocalLength),
                    MaxAperture    = IfNoFloatValueReturnNull(lens.MaxAperture),
                    CompatibleWith = lens.CompatibleWith
                };

                context.Lenses.Add(lensEntity);
                Console.WriteLine($"Successfully imported {lens.Make} {lens.FocalLength}mm f{lens.MaxAperture}");
            }

            context.SaveChanges();
        }
コード例 #20
0
        /// <summary>
        /// Get a lens object, for each make/model. Uses an in-memory cache for speed.
        /// </summary>
        /// <param name="make"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        private Lens GetLens(string make, string model, string serial)
        {
            if (_lensCache == null)
            {
                using ImageContext db = new ImageContext();
                _lensCache            = new ConcurrentDictionary <string, Lens>(db.Lenses
                                                                                .AsNoTracking()
                                                                                .ToDictionary(x => x.Make + x.Model, y => y));
            }

            string cacheKey = make + model;

            if (string.IsNullOrEmpty(cacheKey))
            {
                return(null);
            }

            if (!_lensCache.TryGetValue(cacheKey, out Lens lens))
            {
                // It's a new one.
                lens = new Lens {
                    Make = make, Model = model, Serial = serial
                };

                using var db = new ImageContext();
                db.Lenses.Add(lens);
                db.SaveChanges("SaveLens");

                _lensCache[cacheKey] = lens;
            }

            return(lens);
        }
コード例 #21
0
    public bool AddRequest(Lens handle, bool evaluate = true)
    {
        if (!activeRequests.Contains(handle))
        {
            bool added = false;
            for (int i = 0; i < activeRequests.Count; i++)
            {
                if (handle.Priority >= activeRequests[i].Priority)
                {
                    activeRequests.Insert(i, handle);
                    added = true;
                    break;
                }
            }

            if (!added)
            {
                activeRequests.Add(handle);
            }

            if (evaluate)
            {
                EvaluateRequests();
            }

            return(true);
        }

        return(false);
    }
コード例 #22
0
    private void Start()
    {
        text.text        = string.Format("Time Scale: {0:0.00}", 1f);
        timeScaleRequest = new Lens <float>(this, 1f);

        InvokeManager.Invoke(LaunchBall, launchIntervalRange.Random);
    }
コード例 #23
0
    public static void test11()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST11 tests LENS_HALF_AREA_2D, CIRCLE_SECTOR_AREA_2D, CIRCLE_TRIANGLE_AREA_2D.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    05 April 2008
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int i;

        const double r = 1.0;

        Console.WriteLine("");
        Console.WriteLine("TEST11");
        Console.WriteLine("  LENS_HALF_AREA_2D computes the area of a");
        Console.WriteLine("    circular half lens, defined by joining the endpoints");
        Console.WriteLine("    of a circular arc.");
        Console.WriteLine("  CIRCLE_SECTOR_AREA_2D computes the area of a");
        Console.WriteLine("    circular sector, defined by joining the endpoints");
        Console.WriteLine("    of a circular arc to the center.");
        Console.WriteLine("  CIRCLE_TRIANGLE_AREA_2D computes the signed area of a");
        Console.WriteLine("    triangle, defined by joining the endpoints");
        Console.WriteLine("    of a circular arc and the center.");
        Console.WriteLine("");
        Console.WriteLine("      R       Theta1 Theta2        "
                          + "Sector       Triangle     Half Lens");
        Console.WriteLine("");

        for (i = 0; i <= 12; i++)
        {
            const double theta1 = 0.0;
            double       theta2 = i * 2.0 * Math.PI / 12.0;

            double area1 = Circle.circle_sector_area_2d(r, theta1, theta2);

            double area2 = Circle.circle_triangle_area_2d(r, theta1, theta2);

            double area3 = Lens.lens_half_area_2d(r, theta1, theta2);

            Console.WriteLine("  " + r.ToString(CultureInfo.InvariantCulture).PadLeft(9)
                              + "  " + theta1.ToString(CultureInfo.InvariantCulture).PadLeft(9)
                              + "  " + theta2.ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + area1.ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + area2.ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + area3.ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
        }
    }
コード例 #24
0
    public static void test12()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST12 tests LENS_HALF_AREA_2D, LENS_HALF_H_AREA_2D, LENS_HALF_W_AREA_2D.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    06 April 2008
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int i;

        const double r = 50.0;

        Console.WriteLine("");
        Console.WriteLine("TEST12");
        Console.WriteLine("  For the area of a circular half lens,");
        Console.WriteLine("  LENS_HALF_AREA_2D uses two angles;");
        Console.WriteLine("  LENS_HALF_H_AREA_2D works from the height;");
        Console.WriteLine("  LENS_HALF_W_AREA_2D works from the width.");
        Console.WriteLine("");
        Console.WriteLine("  The circle has radius R = " + r + "");
        Console.WriteLine("");
        Console.WriteLine("  THETA1 THETA2  H     W  Area(THETA) Area(H)  Area(W)");
        Console.WriteLine("");

        for (i = 0; i <= 12; i++)
        {
            const double theta1 = 0.0;
            double       theta2 = i * 2.0 * Math.PI / 12.0;
            double       w      = 2.0 * r * Math.Sin(0.5 * (theta2 - theta1));
            double       h      = r * (1.0 - Math.Cos(0.5 * (theta2 - theta1)));

            double area1 = Lens.lens_half_area_2d(r, theta1, theta2);

            double area2 = Lens.lens_half_h_area_2d(r, h);

            double area3 = Lens.lens_half_w_area_2d(r, w);

            Console.WriteLine("  " + theta1.ToString(CultureInfo.InvariantCulture).PadLeft(6)
                              + "  " + theta2.ToString(CultureInfo.InvariantCulture).PadLeft(6)
                              + "  " + h.ToString(CultureInfo.InvariantCulture).PadLeft(6)
                              + "  " + w.ToString(CultureInfo.InvariantCulture).PadLeft(6)
                              + "  " + area1.ToString(CultureInfo.InvariantCulture).PadLeft(10)
                              + "  " + area2.ToString(CultureInfo.InvariantCulture).PadLeft(10)
                              + "  " + area3.ToString(CultureInfo.InvariantCulture).PadLeft(10) + "");
        }
    }
コード例 #25
0
        public static void ImportPhotographers()
        {
            IEnumerable <PhotographerDto> photographerDtos = ParseJson <PhotographerDto>(Constants.PhotographersPath);

            List <Photographer> photographers = new List <Photographer>();

            using (PhotographyWorkshopContext context = new PhotographyWorkshopContext())
            {
                foreach (PhotographerDto photographerDto in photographerDtos)
                {
                    if (photographerDto.FirstName == null || photographerDto.LastName == null)
                    {
                        Console.WriteLine(Messages.InvalidDate);
                        continue;
                    }

                    string phone = String.Empty;
                    if (photographerDto.Phone != null)
                    {
                        Regex regex = new Regex(@"\+\d{1,3}\/\d{8,10}");
                        if (regex.IsMatch(photographerDto.Phone))
                        {
                            phone = photographerDto.Phone;
                        }
                    }

                    Photographer photographerEntity = new Photographer()
                    {
                        FirstName = photographerDto.FirstName,
                        LastName  = photographerDto.LastName,
                        Phone     = phone
                    };

                    bool alreadyPassedPrimaryCamera = false;
                    photographerEntity.PrimaryCamera = GetRandomCamera(context, alreadyPassedPrimaryCamera);

                    alreadyPassedPrimaryCamera         = true;
                    photographerEntity.SecondaryCamera = GetRandomCamera(context, alreadyPassedPrimaryCamera);

                    foreach (var lensDtoId in photographerDto.Lenses)
                    {
                        Lens lensEntity = context.Lenses.FirstOrDefault(lens => lens.Id == lensDtoId);
                        if (lensEntity != null)
                        {
                            if (CheckLensCompatibility(photographerEntity, lensEntity))
                            {
                                photographerEntity.Lenses.Add(lensEntity);
                            }
                        }
                    }

                    Console.WriteLine($"Successfully imported {photographerEntity.FullName} | Lenses: {photographerEntity.Lenses.Count}");
                    photographers.Add(photographerEntity);
                }

                context.Photographers.AddRange(photographers);
                context.SaveChanges();
            }
        }
コード例 #26
0
    public void AddLense(Lens lens)
    {
        GetComponent <AudioSource>().PlayOneShot(pickupSound);
        Lens original = lenses.item;

        lenses.item = lens;
        lenses.item = original;
    }
コード例 #27
0
 public void AddRequest(Lens <T> handle)
 {
     if (!_activeRequests.Contains(handle))
     {
         _activeRequests.Add(handle);
         EvaluateRequests();
     }
 }
コード例 #28
0
        public ActionResult DeleteConfirmed(int id)
        {
            Lens lens = db.Lenses.Find(id);

            db.Lenses.Remove(lens);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #29
0
 public static Lens <T, V> Compose <T, U, V>(
     this Lens <T, U> lens1,
     Lens <U, V> lens2)
 {
     return(new Lens <T, V>(
                x => lens2.Get(lens1.Get(x)),
                (v, x) => lens1.Set(x, lens2.Set(lens1.Get(x), v))));
 }
コード例 #30
0
ファイル: Lens.cs プロジェクト: ooglykraken/Katabasis
    public static Lens Instance()
    {
        if (instance == null)
        {
            instance = GameObject.FindObjectOfType <Lens>();
        }

        return(instance);
    }
コード例 #31
0
 void SetLense(Lens lens)
 {
     if (lens != null) {
         blurComponent.enabled = true;
         blurComponent.iterations = lens.GetRate();
     } else {
         blurComponent.enabled = false;
     }
 }
コード例 #32
0
        private static bool CheckLensCompatibility(Photographer photographer, Lens lens)
        {
            if (lens.CompatibleWith == photographer.PrimaryCamera.Make || lens.CompatibleWith == photographer.SecondaryCamera.Make)
            {
                return(true);
            }

            return(false);
        }
コード例 #33
0
ファイル: YebisPlugin.cs プロジェクト: Powerino73/paradox
        /// <summary>
        /// Initializes a new instance of the <see cref="YebisPlugin"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public YebisPlugin(string name) : base(name)
        {
            yebis = new Manager();
            ToneMap = yebis.Config.ToneMap;
            Glare = yebis.Config.Glare;
            ColorCorrection = yebis.Config.ColorCorrection;
            Lens = yebis.Config.Lens;
            DepthOfField = yebis.Config.DepthOfField;
            HeatShimmer = yebis.Config.HeatShimmer;
            LightShaft = yebis.Config.LightShaft;
            PreferredFormat = PixelFormat.R16G16B16A16_Float;

            // Make sure that the Depth Stencil will be created with ShaderResource
            Tags.Set(RenderTargetKeys.RequireDepthStencilShaderResource, true);
        }
コード例 #34
0
 void Start()
 {
     lensScript = Camera.main.GetComponent<Lens> ();
     lensScript.enabled = true;
 }
コード例 #35
0
    void FindComponents()
    {
        ScreenOverlayScript = Camera.main.GetComponent<ScreenOverlay> ();

        // Finds the rigidbody this script is attached to.
        rb = GetComponent<Rigidbody> ();

        // Finds Game Controller script.
        gameControllerScript = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();

        // Finds Player Mesh Collider (note collider and mesh comonents are two different GameObjects).
        PlayerCollider = GameObject.Find ("Collider").GetComponent<MeshCollider>();

        // Finds Player Mesh Renderer
        if (isClone == false)
        {
            PlayerMesh = GameObject.FindGameObjectWithTag ("PlayerMesh").GetComponent<MeshRenderer> ();
        }

        // Timescale controller script.
        timeScaleControllerScript = GameObject.FindGameObjectWithTag ("TimeScaleController").GetComponent<TimescaleController> ();

        // Finds color correction curves script.
        ColorCorrectionCurvesScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<ColorCorrectionCurves>();

        // Finds Camera Shake script.
        if (GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera> ().enabled == true && isClone == false)
        {
            camShakeScrpt = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraShake> ();
            LensScript = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Lens> ();
        }

        Shafts = GameObject.FindGameObjectWithTag ("Shafts");
    }