Beispiel #1
0
        public bool Equals(PhysicalObject other)
        {
            if (other == null)
            {
                return(false);
            }

            return(ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Position.Equals(other.Position) &&
                   UprootLimit.Equals(other.UprootLimit) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   IsPickup.Equals(other.IsPickup) &&
                   IsPickupInShop.Equals(other.IsPickupInShop) &&
                   IsPickupOutOfStock.Equals(other.IsPickupOutOfStock) &&
                   IsGlassCracked.Equals(other.IsGlassCracked) &&
                   IsGlassBroken.Equals(other.IsGlassBroken) &&
                   HasBeenDamaged.Equals(other.HasBeenDamaged) &&
                   UseCarColors.Equals(other.UseCarColors) &&
                   CostValue.Equals(other.CostValue) &&
                   BonusValue.Equals(other.BonusValue) &&
                   CollisionDamageMultiplier.Equals(other.CollisionDamageMultiplier) &&
                   CollisionDamageEffect.Equals(other.CollisionDamageEffect) &&
                   SpecialCollisionResponseCases.Equals(other.SpecialCollisionResponseCases) &&
                   EndOfLifeTime.Equals(other.EndOfLifeTime) &&
                   EntityType.Equals(other.EntityType) &&
                   EntityStatus.Equals(other.EntityStatus) &&
                   EntityFlags.Equals(other.EntityFlags));
        }
Beispiel #2
0
 public ModelEventArgs(ItemModel item_model, ModelIndex parent_index, int start_id, int count = 1)
 {
     d_itemModel   = item_model;
     d_parentIndex = parent_index;
     d_startId     = start_id;
     d_count       = count;
 }
        private ObjectModel FindModel(string modelId)
        {
            var appModel = ServiceContext.ObjectService.ApplicationModel;

            if (appModel.Model.TryGetValue(modelId, out var result))
            {
                return(result);
            }

            ModelIndex.TryGetValue(modelId.AfterLast("."), out var availableModels);

            if (availableModels == null)
            {
                throw new ModelNotFoundException(modelId);
            }

            if (availableModels.Count > 1)
            {
                throw new AmbiguousModelException(availableModels);
            }

            if (availableModels.Count <= 0)
            {
                throw new ModelNotFoundException(modelId);
            }

            return(availableModels[0]);
        }
Beispiel #4
0
        public ModelIndex Get(string targetName)
        {
            if (!_items.TryGetValue(targetName, out ModelIndex result))
            {
                _items.Add(targetName, (result = new ModelIndex(this._parent, targetName)));
            }

            return(result);
        }
Beispiel #5
0
        public bool Equals(Pickup other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   HasBeenPickedUp.Equals(other.HasBeenPickedUp) &&
                   Value.Equals(other.Value) &&
                   ObjectIndex.Equals(other.ObjectIndex) &&
                   RegenerationTime.Equals(other.RegenerationTime) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   PoolIndex.Equals(other.PoolIndex) &&
                   Position.Equals(other.Position));
        }
Beispiel #6
0
        public bool Equals(PlayerPed other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Position.Equals(other.Position) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   Health.Equals(other.Health) &&
                   Armor.Equals(other.Armor) &&
                   Weapons.SequenceEqual(other.Weapons) &&
                   MaxStamina.Equals(other.MaxStamina) &&
                   TargetableObjects.SequenceEqual(other.TargetableObjects) &&
                   MaxWantedLevel.Equals(other.MaxWantedLevel) &&
                   MaxChaosLevel.Equals(other.MaxChaosLevel) &&
                   ModelName.Equals(other.ModelName));
        }
Beispiel #7
0
        public bool Equals(Vehicle other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Matrix.Equals(other.Matrix) &&
                   EntityType.Equals(other.EntityType) &&
                   EntityStatus.Equals(other.EntityStatus) &&
                   EntityFlags.Equals(other.EntityFlags) &&
                   AutoPilot.Equals(other.AutoPilot) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   AlarmState.Equals(other.AlarmState) &&
                   MaxNumPassengers.Equals(other.MaxNumPassengers) &&
                   Field1D0h.Equals(other.Field1D0h) &&
                   Field1D4h.Equals(other.Field1D4h) &&
                   Field1D8h.Equals(other.Field1D8h) &&
                   Field1DCh.Equals(other.Field1DCh) &&
                   SteerAngle.Equals(other.SteerAngle) &&
                   GasPedal.Equals(other.GasPedal) &&
                   BrakePedal.Equals(other.BrakePedal) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   IsLawEnforcer.Equals(other.IsLawEnforcer) &&
                   IsLockedByScript.Equals(other.IsLockedByScript) &&
                   IsEngineOn.Equals(other.IsEngineOn) &&
                   IsHandbrakeOn.Equals(other.IsHandbrakeOn) &&
                   LightsOn.Equals(other.LightsOn) &&
                   HasFreebies.Equals(other.HasFreebies) &&
                   Health.Equals(other.Health) &&
                   CurrentGear.Equals(other.CurrentGear) &&
                   ChangeGearTime.Equals(other.ChangeGearTime) &&
                   TimeOfDeath.Equals(other.TimeOfDeath) &&
                   BombTimer.Equals(other.BombTimer) &&
                   DoorLock.Equals(other.DoorLock));
        }
Beispiel #8
0
        /// <summary>Indexes this instance.</summary>
        public async Task <IActionResult> Index()
        {
            if (User.Identity.IsAuthenticated)
            {
                var itemType = await _context.ItemType.Include(i => i.Items).ThenInclude(m => m.Movements).ToListAsync();

                var animals = await _context.Animal.ToListAsync();

                int numAnimals   = _context.Animal.Count();
                int colonies     = _context.Colony.Count();
                var appointments = await _context.Appointment.Include(a => a.Colony).Include(a => a.Animal).ToListAsync();

                ModelIndex modelIndex = new ModelIndex()
                {
                    ItemTypes = itemType, Animals = animals, NumAnimals = numAnimals, Colonies = colonies, Appointments = appointments
                };

                return(View(modelIndex));
            }

            return(Redirect("Identity/Account/Login"));
        }
Beispiel #9
0
 /*!
  * \brief
  * Compares semantically the contents of the specified two indices and returns:
  * - 0 if they are equal.
  * - -1 if first index is less than the second index.
  * - 1 if the first index is bigger than the second index.
  *
  * This function is used by the view when it needs to sort the items.
  */
 public abstract int CompareIndices(ModelIndex index1, ModelIndex index2);
Beispiel #10
0
 /// <summary>
 /// Compares semantically two indices and returns true if they are equal,
 /// false otherwise.
 /// </summary>
 /// <param name="index1"></param>
 /// <param name="index2"></param>
 /// <returns></returns>
 public virtual bool AreIndicesEqual(ModelIndex index1, ModelIndex index2)
 {
     return(CompareIndices(index1, index2) == 0);
 }
 public static string PortSettingsAtModelIndex(ModelIndex modelIndex)
 {
     return((string)modelCapabilityDictionary[modelIndex][(int)ModelCapabilityIndex.PortSettings]);
 }
Beispiel #12
0
        public async void Handle_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            ((ListView)sender).SelectedItem = null;

            ListViewItem listViewItem = (ListViewItem)e.Item;

            string portName   = listViewItem.PortInfo.PortName;
            string modelName  = listViewItem.PortInfo.ModelName;
            string macAddress = listViewItem.PortInfo.MacAddress;

            if (false)     // Ex1. Direct Setting.
            {
                //string portSettings = "";
                //string portSettings = "mini";
                //string portSettings = "escpos";
                //string portSettings = "Portable";

                //StarIoExtEmulation emulation = StarIoExtEmulation.StarPRNT;
                //StarIoExtEmulation emulation = StarIoExtEmulation.StarLine;
                //StarIoExtEmulation emulation = StarIoExtEmulation.StarGraphic;
                //StarIoExtEmulation emulation = StarIoExtEmulation.EscPos;
                //StarIoExtEmulation emulation = StarIoExtEmulation.EscPosMobile;
                //StarIoExtEmulation emulation = StarIoExtEmulation.StarDotImpact;
                //StarIoExtEmulation emulation = StarIoExtEmulation.StarPRNTL;

                //Configuration.PortName = portName;
                //Configuration.ModelName = modelName;
                //Configuration.MacAddress = macAddress;
                //Configuration.PortSettings = portSettings;
                //Configuration.Emulation = emulation;
                //Configuration.CashDrawerOpenActiveHigh = true;

                //await Navigation.PopAsync(true);
            }
            else if (false)     // Ex2. Direct Setting.
            {
                //ModelIndex modelIndex = ModelIndex.MCPrint2;
                //ModelIndex modelIndex = ModelIndex.MCPrint3;
                //ModelIndex modelIndex = ModelIndex.MPOP;
                //ModelIndex modelIndex = ModelIndex.FVP10;
                //ModelIndex modelIndex = ModelIndex.TSP100;
                //ModelIndex modelIndex = ModelIndex.TSP650II;
                //ModelIndex modelIndex = ModelIndex.TSP700II;
                //ModelIndex modelIndex = ModelIndex.TSP800II;
                //ModelIndex modelIndex = ModelIndex.SM_S210I;
                //ModelIndex modelIndex = ModelIndex.SM_S220I;
                //ModelIndex modelIndex = ModelIndex.SM_S230I;
                //ModelIndex modelIndex = ModelIndex.SM_T300I;
                //ModelIndex modelIndex = ModelIndex.SM_T400I;
                //ModelIndex modelIndex = ModelIndex.BSC10;
                //ModelIndex modelIndex = ModelIndex.SM_S210I_StarPRNT;
                //ModelIndex modelIndex = ModelIndex.SM_S220I_StarPRNT;
                //ModelIndex modelIndex = ModelIndex.SM_S230I_StarPRNT;
                //ModelIndex modelIndex = ModelIndex.SM_T300I_StarPRNT;
                //ModelIndex modelIndex = ModelIndex.SM_T400I_StarPRNT;
                //ModelIndex modelIndex = ModelIndex.SM_L200;
                //ModelIndex modelIndex = ModelIndex.SP700;
                //ModelIndex modelIndex = ModelIndex.SM_L300;

                //string portSettings = ModelCapability.PortSettingsAtModelIndex(modelIndex);
                //StarIoExtEmulation emulation = ModelCapability.EmulationAtModelIndex(modelIndex);

                //Configuration.PortName = portName;
                //Configuration.ModelName = modelName;
                //Configuration.MacAddress = macAddress;
                //Configuration.PortSettings = portSettings;
                //Configuration.Emulation = emulation;
                //Configuration.CashDrawerOpenActiveHigh = true;

                //await Navigation.PopAsync(true);
            }
            else if (false)     // Ex3. Indirect Setting.
            {
                //ModelIndex modelIndex = ModelCapability.ModelIndexAtModelName(modelName);

                //string portSettings = ModelCapability.PortSettingsAtModelIndex(modelIndex);
                //StarIoExtEmulation emulation = ModelCapability.EmulationAtModelIndex(modelIndex);

                //Configuration.PortName = portName;
                //Configuration.ModelName = modelName;
                //Configuration.MacAddress = macAddress;
                //Configuration.PortSettings = portSettings;
                //Configuration.Emulation = emulation;
                //Configuration.CashDrawerOpenActiveHigh = true;

                //await Navigation.PopAsync(true);
            }
            else     // Ex4. Indirect Setting.
            {
                ModelIndex modelIndex = ModelCapability.ModelIndexAtModelName(modelName);

                if (modelIndex != ModelIndex.None)
                {
                    if (!await DisplayAlert("Confirm.", "Is your printer " + ModelCapability.TitleAtModelIndex(modelIndex) + "?", "YES", "NO"))
                    {
                        modelIndex = ModelIndex.None;
                    }
                }

                if (modelIndex == ModelIndex.None)
                {
                    List <string> buttonList = new List <string>();

                    for (int i = 0; i < ModelCapability.ModelIndexCount; i++)
                    {
                        buttonList.Add(ModelCapability.TitleAtModelIndex(ModelCapability.ModelIndexAtIndex(i)));
                    }

                    int index = buttonList.IndexOf(await DisplayActionSheet("What is your printer?", "Cancel", null, buttonList.ToArray()));

                    if (index >= 0)
                    {
                        modelIndex = ModelCapability.ModelIndexAtIndex(index);
                    }
                }

                if (modelIndex != ModelIndex.None)
                {
                    bool cashDrawerOpenActiveHigh = true;

                    if (ModelCapability.CashDrawerOpenActiveAtModelIndex(modelIndex))
                    {
                        List <string> buttonsList = new List <string>(new string[] { "High when Open", "Low when Open" });

                        switch (buttonsList.IndexOf(await DisplayActionSheet("Select CashDrawer Open Status.", "Cancel", null, buttonsList.ToArray())))
                        {
                        default:
                            modelIndex = ModelIndex.None;
                            break;

                        case 0:
                            cashDrawerOpenActiveHigh = true;
                            break;

                        case 1:
                            cashDrawerOpenActiveHigh = false;
                            break;
                        }
                    }

                    if (modelIndex != ModelIndex.None)
                    {
                        Configuration.PortName                 = portName;
                        Configuration.ModelName                = modelName;
                        Configuration.MacAddress               = macAddress;
                        Configuration.PortSettings             = ModelCapability.PortSettingsAtModelIndex(modelIndex);
                        Configuration.Emulation                = ModelCapability.EmulationAtModelIndex(modelIndex);
                        Configuration.CashDrawerOpenActiveHigh = cashDrawerOpenActiveHigh;

                        await Navigation.PopAsync(true);
                    }
                }
            }
        }
Beispiel #13
0
 /*!
  * \brief
  * Returns the string representation of the specified ModelIndex based on
  * the specified role.
  * It is up to the view to interpret the string based on the role requested.
  *
  * \remark
  * For example, in the case of an image decoration, the name of the image
  * could be returned, and the view would use ImageManager to retrieve the
  * specific Image instance by the name and render that.
  *
  * An example implementation for the IDR_Icon role could be:
  * \code{.cpp}
  * Image* img; // get the image from somewhere
  *
  * String getData(const ModelIndex& modelIndex, ItemDataRole role)
  * {
  *  if (role == IDR_Icon) return img->getName();
  * }
  * \endcode
  */
 public abstract string GetData(ModelIndex modelIndex, ItemDataRole role = ItemDataRole.IDR_Text);
 public static bool CashDrawerOpenActiveAtModelIndex(ModelIndex modelIndex)
 {
     return((bool)modelCapabilityDictionary[modelIndex][(int)ModelCapabilityIndex.CashDrawerOpenActive]);
 }
Beispiel #15
0
 public static int GetInternalIndex(ModelIndex index)
 {
     return(index.Index - 1);
 }
 public static string TitleAtModelIndex(ModelIndex modelIndex)
 {
     return((string)modelCapabilityDictionary[modelIndex][(int)ModelCapabilityIndex.Title]);
 }
Beispiel #17
0
 /// <summary>
 /// Returns true if the specified ModelIndex is valid, false otherwise.
 ///
 /// Usually, an index is valid if at least it does not contain a reference
 /// to a NULL object. Extra logic can be added to check that the referenced
 /// object is actually part of the model.
 /// </summary>
 /// <param name="modelIndex"></param>
 /// <returns></returns>
 public abstract bool IsValidIndex(ModelIndex modelIndex);
Beispiel #18
0
 /*!
  * \brief
  * Returns the ModelIndex which is parent for the specified ModelIndex.
  *
  * \return
  * The returned index should be equal to getRootIndex() for direct children
  * of the root index. If this is called on the root index, it returns
  * an invalid (empty/default) ModelIndex.
  */
 public abstract ModelIndex GetParentIndex(ModelIndex modelIndex);
Beispiel #19
0
 /*!
  * \brief
  * Returns the ordinal id (index) of the child represented by the given
  * index, in its parent's list or -1 if no such child exists.
  */
 public abstract int GetChildId(ModelIndex modelIndex);
Beispiel #20
0
 /// <summary>
 /// Notifies any listeners of the EventChildDataChanged event that existing
 /// children's data has been updated.
 /// </summary>
 /// <param name="parent_index"></param>
 /// <param name="start_id"></param>
 /// <param name="count"></param>
 /// <remarks>
 /// If this method is overridden, it *needs* to call this base method or invoke
 /// manually the EventChildDataChanged event.
 /// </remarks>
 public virtual void NotifyChildrenDataChanged(ModelIndex parent_index, int start_id, int count)
 {
     FireEvent(EventChildrenDataChanged, new ModelEventArgs(this, parent_index, start_id, count));
 }
Beispiel #21
0
 /// <summary>
 /// Notifies any listeners of the EventChildrenWillBeAdded event that new children
 /// will be added to this model.
 /// </summary>
 /// <param name="parentIndex">
 /// The parent index under which children will be added.
 /// </param>
 /// <param name="startId">
 /// The id of the child starting from which children will be added.
 /// </param>
 /// <param name="count">
 /// The number of children that will be added.
 /// </param>
 /// <remarks>
 /// If this method is overridden, it *needs* to call this base method or invoke
 /// manually the EventChildrenWillBeAdded event.
 /// </remarks>
 public virtual void NotifyChildrenWillBeAdded(ModelIndex parentIndex, int startId, int count)
 {
     FireEvent(EventChildrenWillBeAdded, new ModelEventArgs(this, parentIndex, startId, count));
 }
Beispiel #22
0
 /*!
  * \brief
  * Creates a new ModelIndex that points to the specified child of the
  * specified parent index.
  *
  * To create an index for a nested item, you need to chain the index creation.
  * Given a model for the following tree:
  * <pre>
  * A
  |
  |--B
  |  |--C
  |
  |--D
  | </pre>
  |
  | We can compute the indices for the nodes in the following way:
  | \code{.cpp}
  | ModelIndex a = makeIndex(0, getRootIndex());
  | ModelIndex b = makeIndex(0, a);
  | ModelIndex c = makeIndex(0, b);
  | ModelIndex d = makeIndex(1, a);
  | \endcode
  |
  | \param child
  | The ordinal child id (index), which is a number between 0 and
  | getChildrenCount(parentIndex). This will specify which children in the
  | parent's index list of children should be referenced.
  */
 public abstract ModelIndex MakeIndex(int child, ModelIndex parentIndex);
 public static StarIoExtEmulation EmulationAtModelIndex(ModelIndex modelIndex)
 {
     return((StarIoExtEmulation)modelCapabilityDictionary[modelIndex][(int)ModelCapabilityIndex.Emulation]);
 }
Beispiel #24
0
        public void UpdateState()
        {
            try
            {
                if (CurrentBaker != null)
                {
                    if (CurrentBaker.IsInProgress())
                    {
                        CurrentBaker.UpdateState();

                        if (CurrentBaker.IsCancelled)
                        {
                            throw new Exception("Cancelled");
                        }
                        return;
                    }
                    else
                    {
                        EditorUtility.ClearProgressBar();

                        ModelIndex++;
                    }
                }

                Model model = NextModel();
                if (model != null)
                {
                    string sIndex = "";
                    if (modelList.Count > 1)
                    {
                        sIndex = ModelIndex.ToString().PadLeft((modelList.Count + 1).ToString().Length, '0');
                    }

                    for (int i = 0; i < modelList.Count; ++i)
                    {
                        modelList[i].gameObject.SetActive(false);
                    }
                    model.gameObject.SetActive(true);

                    if (Model.IsMeshModel(model))
                    {
                        MeshModel            meshModel       = Model.AsMeshModel(model);
                        List <MeshAnimation> validAnimations = meshModel.GetValidAnimations();

                        if (validAnimations.Count > 0)
                        {
                            CurrentBaker = new MeshBaker(model, validAnimations, studio, sIndex, batchingFolderPath);
                        }
                        else
                        {
                            CurrentBaker = new StaticBaker(model, studio, sIndex, batchingFolderPath);
                        }
                    }
                    else if (Model.IsParticleModel(model))
                    {
                        CurrentBaker = new ParticleBaker(model, studio, sIndex, batchingFolderPath);
                    }
                }
                else
                {
                    EditorUtility.FocusProjectWindow();

                    if (needPassingFinalUpdate)
                    {
                        needPassingFinalUpdate = false;
                        return;
                    }

                    Finish();
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                Finish();
            }
        }
Beispiel #25
0
 /*!
  * \brief
  * Returns the number of direct children of the specified ModelIndex.
  */
 public abstract int GetChildCount(ModelIndex modelIndex);