public void unhireMounts (MountType mountType) {
		foreach (MountCard card in mountCards) {
			if (card.mountType != mountType) {
				card.unHire();
			}
		}
	}
Exemple #2
0
 internal MountInfo(string directory, string block, MountType type, string mounttype)
 {
     _directory = directory;
     _block     = block;
     _type      = type;
     _mounttype = mounttype;
 }
Exemple #3
0
    public static void SetGestureCondition <T>(T ob, MountType mountType, CircleDirection circleDirection, float progress, UseArea useArea, UsingHand usingHand) where T : IGesture
    {
        if (ob._gestureType == GestureType.circle) // If gesture type is circle.
        {
            Circle_Gesture tempCircle = ob as Circle_Gesture;

            /* Initiate gesture option */
            tempCircle._state       = Gesture.GestureState.STATE_INVALID;
            tempCircle._isChecked   = false;
            tempCircle._isClockwise = -1;
            tempCircle._isPlaying   = false;

            /* Initiate to user options. */
            tempCircle._usingHand  = usingHand;
            tempCircle._mountType  = mountType;
            tempCircle._useArea    = useArea;
            tempCircle.MinProgress = progress;
            if (circleDirection == CircleDirection.Clockwise)
            {
                tempCircle._useDirection = 1;
            }
            else
            {
                tempCircle._useDirection = -1;
            }
        }
    }
Exemple #4
0
    void AddPoints(MountType inType, Transform trans)
    {
        string typeData = "";

        foreach (string str in fileStrings)
        {
            if (str.Length > 0)
            {
                string str2 = str.Substring(0, str.IndexOf(']'));
                if (str.Substring(0, str.IndexOf(']')) == inType.ToString())
                {
                    typeData = str;
                }
            }
        }
        string[] filePoints = typeData.Split(':');
        for (int i = 1; i < filePoints.Length; i++)
        {
            string[] xyz = filePoints[i].Split(',');
            float    x;
            float.TryParse(xyz[0], out x);
            float y;
            float.TryParse(xyz[1], out y);
            float z;
            float.TryParse(xyz[2], out z);
            int type;
            int.TryParse(xyz[3], out type);
            mounting.parentMountType = inType;
            mounting.AddPoint(new Vector3(x, y, z));
            mounting.AddMountType((MountType)type);
        }
    }
Exemple #5
0
    /// <summary>
    /// 坐骑列表请求协议(1 坐骑列表 2 皮肤列表)
    /// </summary>
    public void C2S_GetMountList(MountType type)
    {
        //Debug.Log(" C2S_GetMountList  " + (int)type);
        pt_req_ride_info_d430 msg = new pt_req_ride_info_d430();

        msg.state = (int)type;
        NetMsgMng.SendMsg(msg);
    }
Exemple #6
0
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            if (ComboBox.SelectedItem == null)
            {
                return;
            }

            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }
            List <IFileSystem> filesystems = new List <IFileSystem>();
            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to mount...", new Task(() =>
            {
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    /*IStorage inStorage = nca.OpenStorage(index, IntegrityCheckLevel.ErrorOnInvalid);
                     * IFile outFile = new LocalFile("./tmp.bin", OpenMode.Write | OpenMode.AllowAppend);
                     * IStorage outStorage = outFile.AsStorage();
                     * inStorage.GetSize(out long size);
                     * long buffLen = 0x10000;
                     * for (int i = 0; i < (int)Math.Min(Math.Ceiling((double)size / buffLen), 5); i++)
                     * {
                     *  long off = i * buffLen;
                     *  long left = size - off;
                     *  long toRead = Math.Min(buffLen, left);
                     *
                     *  byte[] buff = new byte[toRead];
                     *
                     *  inStorage.Read(off, buff);
                     *  outStorage.Write(off, buff);
                     * }
                     * //inStorage.Dispose();
                     * outFile.Dispose();*/

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();
                LayeredFileSystem fs = new LayeredFileSystem(filesystems);
                string typeString    = sectionType.ToString();
                MountService.Mount(new MountableFileSystem(fs, $"Mounted {mountType.ToString().ToLower()}", typeString, OpenMode.Read));
            })));
        }
Exemple #7
0
        public ContainerBuilder Mount(string fqHostPath, string fqContainerPath, MountType access)
        {
            var hp = FdOs.IsWindows() && CommandExtensions.IsToolbox()
        ? ((TemplateString)fqHostPath).Rendered.ToMsysPath()
        : ((TemplateString)fqHostPath).Rendered;

            _config.CreateParams.Volumes =
                _config.CreateParams.Volumes.ArrayAdd($"{hp.EscapePath()}:{fqContainerPath.EscapePath()}:{access.ToDocker()}");
            return(this);
        }
        public ContainerBuilder Mount(string fqHostPath, string fqContainerPath, MountType access)
        {
            var hp = Environment.OSVersion.IsWindows()
              ? ((TemplateString)fqHostPath).Rendered.ToMsysPath()
              : ((TemplateString)fqHostPath).Rendered;

            _config.CreateParams.Volumes =
                _config.CreateParams.Volumes.ArrayAdd($"{hp}:{fqContainerPath}:{access.ToDocker()}");
            return(this);
        }
        private void ExtractClicked(object sender, RoutedEventArgs e)
        {
            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }

            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];
            string path = Path.Text;

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to extract...", new Task(() =>
            {
                List <IFileSystem> filesystems = new List <IFileSystem>();
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();

                LayeredFileSystem lfs      = new LayeredFileSystem(filesystems);
                ExtractFileSystemTask task = new ExtractFileSystemTask($"Extracting {sectionType}...", lfs, path);

                Dispatcher.InvokeAsync(() =>
                {
                    ProgressView view = new ProgressView(new List <ProgressTask>()
                    {
                        task
                    });
                    NavigationWindow window = new NavigationWindow
                    {
                        ShowsNavigationUI = false // get rid of the t r a s h
                    };
                    window.Navigate(view);

                    TaskManagerPage.Current.Queue.Submit(task);

                    window.Owner = Window.GetWindow(this);
                    window.ShowDialog();
                });
            })));
        }
Exemple #10
0
        public static string ToDocker(this MountType access)
        {
            switch (access)
            {
            case MountType.ReadOnly:
                return("ro");

            case MountType.ReadWrite:
                return("rw");
            }

            throw new NotImplementedException($"Not implemented type: {access}");
        }
    protected override string GetGameObjectName()
    {
        MountType mount = this.Mount;

        if (mount != MountType.WOW_HEARTHSTEED)
        {
            if (mount == MountType.HEROES_MAGIC_CARPET_CARD)
            {
                return("CardMountReward");
            }
            return(string.Empty);
        }
        return("HearthSteedReward");
    }
        public override void OnStart()
        {
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // If the quest is complete, this behavior is already done...
            // So we don't want to falsely inform the user of things that will be skipped.
            if (!IsDone)
            {
                TreeRoot.GoalText = "Mounting for " + MountType.ToString() + " travel";
            }
        }
Exemple #13
0
    public static void SetGestureCondition <T>(T ob, MountType mountType, UseArea useArea, UsingHand usingHand, PalmDirection palmDirection) where T : IGesture
    {
        if (ob._gestureType == GestureType.fliphand)// If gesture type is flip hand.
        {
            FlipHand_Gesture tempFlipHand = ob as FlipHand_Gesture;

            /* Initiate gesture option */
            tempFlipHand._isChecked = false;

            /* Initiate to user options. */
            tempFlipHand._mountType     = mountType;
            tempFlipHand._useArea       = useArea;
            tempFlipHand._usingHand     = usingHand;
            tempFlipHand._palmDirection = palmDirection;
        }
    }
        /// <summary>
        /// Initializes the device settings.
        /// </summary>
        static Hulk()
        {
            logger.Debug("Static create: Hulk");

            DataController.Instance.PCReady = false;
            homingPhase = HomingPhase.Unhomed;

            mount = (ConfigurationManager.AppSettings["MountType"] == "Back") ?
                    MountType.Back : MountType.Seat;

            InitializeMotionStates();

            DataController.Instance.StartTasks();
            InputController.AcquireJoystick();

            status = Status.Initializing;
        }
Exemple #15
0
        public bool RemountSystem(MountType _type)
        {
            if (!_device.HasRoot)
            {
                return(false);
            }

            AdbCommand adbCmd = Adb.FormAdbShellCommand(_device, true, "mount", "-o", "remount,rw", "/system");

            Adb.ExecuteAdbCommandNoReturn(adbCmd);

            if (_device.FileSystem.SystemMountInfo.MountType == _type)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #16
0
        //void PushFile();
        //void PullFile();

        /// <summary>
        /// Mounts connected Android device's file system as specified
        /// </summary>
        /// <param name="type">The desired <see cref="MountType"/> (RW or RO)</param>
        /// <returns>True if remount is successful, False if remount is unsuccessful</returns>
        /// <example>The following example shows how you can mount the file system as Read-Writable or Read-Only
        /// <code>
        /// // This example demonstrates mounting the Android device's file system as Read-Writable
        /// using System;
        /// using RegawMOD.Android;
        ///
        /// class Program
        /// {
        ///     static void Main(string[] args)
        ///     {
        ///         AndroidController android = AndroidController.Instance;
        ///         Device device;
        ///
        ///         Console.WriteLine("Waiting For Device...");
        ///         android.WaitForDevice(); //This will wait until a device is connected to the computer
        ///         device = android.ConnectedDevices[0]; //Sets device to the first Device in the collection
        ///
        ///         Console.WriteLine("Connected Device - {0}", device.SerialNumber);
        ///
        ///         Console.WriteLine("Mounting System as RW...");
        ///         Console.WriteLine("Mount success? - {0}", device.RemountSystem(MountType.RW));
        ///     }
        /// }
        ///
        ///	// The example displays the following output (if mounting is successful):
        ///	//		Waiting For Device...
        ///	//		Connected Device - {serial # here}
        ///	//		Mounting System as RW...
        ///	//		Mount success? - true
        /// </code>
        /// </example>
        public bool RemountSystem(MountType type)
        {
            if (!this.device.HasRoot)
            {
                return(false);
            }

            AdbCommand adbCmd = Adb.FormAdbShellCommand(this.device, true, "mount", string.Format("-o remount,{0} -t yaffs2 {1} /system", type.ToString().ToLower(), this.systemMount.Block));

            Adb.ExecuteAdbCommandNoReturn(adbCmd);

            UpdateMountPoints();

            if (this.systemMount.MountType == type)
            {
                return(true);
            }

            return(false);
        }
Exemple #17
0
    public static void SetGestureCondition <T>(T ob, MountType mountType, UseArea useArea, UsingHand usingHand) where T : IGesture
    {
        if (ob._gestureType == GestureType.keytab)// If gesture type is keytab.
        {
            KeyTap_Gesture tempKeyTab = ob as KeyTap_Gesture;

            /* Initiate gesture option */
            tempKeyTab._isChecked = false;

            /* Initiate to user options. */
            tempKeyTab._mountType = tempKeyTab.MountType;
            tempKeyTab._useArea   = useArea;
            tempKeyTab._usingHand = usingHand;
        }
        else if (ob._gestureType == GestureType.screentab)// If gesture type is screentab.
        {
            ScreenTap_Gesture tempScreenTab = ob as ScreenTap_Gesture;

            /* Initiate gesture option */
            tempScreenTab._isChecked = false;

            /* Initiate to user options. */
            tempScreenTab._useArea   = useArea;
            tempScreenTab._mountType = tempScreenTab.MountType;
            tempScreenTab._usingHand = usingHand;
        }
        else if (ob._gestureType == GestureType.grabhand)// If gesture type is grabbing hand.
        {
            GrabHand_Gesture tempGrabHand = ob as GrabHand_Gesture;

            /* Initiate gesture option */
            tempGrabHand._isChecked = false;

            /* Initiate to user options. */
            tempGrabHand._mountType = mountType;
            tempGrabHand._useArea   = useArea;
            tempGrabHand._usingHand = usingHand;
        }
    }
Exemple #18
0
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }
            List <IFileSystem> filesystems = new List <IFileSystem>();
            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to mount...", new Task(() =>
            {
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    if (section.IsPatchSection())
                    {
                        MainNca.BaseNca = nca.Nca;
                    }

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();
                LayeredFileSystem fs = new LayeredFileSystem(filesystems);
                string typeString    = sectionType.ToString();
                MountService.Mount(new MountableFileSystem(fs, $"Mounted {mountType.ToString().ToLower()}", typeString, OpenMode.Read));
            })));
        }
Exemple #19
0
        /// <inheritdoc />
        public async Task <Mount> CreateMount(string name, MountType type, CancellationToken cancellationToken = default)
        {
            var mount = await this.Context.Mounts.SingleOrDefaultAsync(m => m.Name == name, cancellationToken)
                        .ConfigureAwait(false);

            if (mount != null)
            {
                throw new EntityExistsException <Mount>(name);
            }

            var entity = new Mount
            {
                Name = name, Type = type,
            };

            entity.Paths.Add(new MountPath
            {
                Path = RootPath,
            });

            this.Context.Mounts.Add(entity);

            return(entity);
        }
Exemple #20
0
        public static async Task <DeviceRule[]> GerDeviceRulesList(this ApplicationDbContext _dbContext, Guid devid, MountType mountType)
        {
            DeviceRule[] lst = null;
            var          r   = from dr in _dbContext.DeviceRules.Include(d => d.Device).Include(d => d.FlowRule) where dr.Device.Id == devid && dr.FlowRule.MountType == mountType select dr;

            if (r.Any())
            {
                lst = await r.ToArrayAsync();
            }
            return(lst);
        }
Exemple #21
0
 public ContainerBuilder MountVolume(IVolumeService volume, string fqContainerPath, MountType access)
 {
     _config.CreateParams.Volumes =
         _config.CreateParams.Volumes.ArrayAdd($"{volume.Name}:{fqContainerPath.EscapePath()}:{access.ToDocker()}");
     return(this);
 }
Exemple #22
0
        public static async Task <Guid> GerDeviceRpcRulesList(this ApplicationDbContext _dbContext, Guid devid, MountType mountType, string method)
        {
            var rules = await GerDeviceRulesList(_dbContext, devid, mountType);

            var g = (rules.FirstOrDefault(r => r.FlowRule.Name == method)?.FlowRule.RuleId);

            return(g.GetValueOrDefault());
        }
Exemple #23
0
        /// <summary>
        /// Constructor for all beam weapon types.
        /// </summary>
        /// <param name="Title">Name of the beam weapon, user entered string, or default string.</param>
        /// <param name="Type">What type of beam weapon this is, note that componentTypeTN encompasses much more than beam weapon types, don't give those values to this function.</param>
        /// <param name="SizeTech">Every beam weapon either has a calibre size, except for particle beams, which use warhead strength, and gauss which give a rate of fire. All use this variable.</param>
        /// <param name="RangeTech">Every beam weapon has a range tech except for plasma carronades which do not have any way to increase range or decrease damage falloff.</param>
        /// <param name="CapacitorTech">Every beam weapon has a capacitor tech associated with it except gauss. Shotcount tech for gauss.</param>
        /// <param name="Reduction">Lasers and Gauss both have size reduction capabilities, though with drawbacks for both types: recharge rate and accuracy respectively.</param>
        public BeamDefTN(String Title, ComponentTypeTN Type, byte SizeTech, byte RangeTech, byte CapacitorTech, float Reduction, MountType MType = MountType.Standard)
        {
#warning function has beam weapon range related magic numbers and others
            if (Type < ComponentTypeTN.Rail || Type > ComponentTypeTN.AdvParticle)
            {
                /// <summary>
                /// Error, bad ID passed to BeamDefTN.
                /// </summary>
                return;
            }
            Id = Guid.NewGuid();
            componentType = Type;

            Name = Title;
            m_oWeaponSizeTech = SizeTech;
            m_oWeaponRangeTech = RangeTech;
            m_oWeaponCapacitorTech = CapacitorTech;
            m_oWeaponCapacitor = Constants.BeamWeaponTN.Capacitor[CapacitorTech];
            m_oWMType = MType;

            m_oShotCount = 1;
            m_oBaseAccuracy = 1.0f;

            m_lDamage = new BindingList<ushort>();

            int RangeIncrement;

            switch (componentType)
            {
                /// <summary>
                /// Laser is the the most basic jack of all trade beam weapon.
                /// </summary>
                case ComponentTypeTN.Laser:

                    /// <summary>
                    /// I Suspect that size is 3.2cm per HS but am just using a table for now.
                    /// </summary>
                    size = (float)Math.Round(Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech] * Reduction);

                    /// <summary>
                    /// The first entry in the damage table is max damage at point blank(0-10k range) damage.
                    /// </summary>
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]);

                    /// <summary>
                    /// Have to modify capacitor by size reduction values.
                    /// </summary>
                    if (Reduction == 0.75f)
                        m_oWeaponCapacitor = m_oWeaponCapacitor / 4.0f;
                    else if (Reduction == 0.5f)
                        m_oWeaponCapacitor = m_oWeaponCapacitor / 20.0f;

                    /// <summary>
                    /// Damage, Size, and Range are all modified by spinal mounting:
                    /// </summary>
                    switch (m_oWMType)
                    {
                        case MountType.Spinal:
                            size = (float)Math.Round(size * 1.25f);
                            m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 1.5f);
                            break;
                        case MountType.AdvancedSpinal:
                            size = (float)Math.Round(size * 1.5f);
                            m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 2.0f);
                            break;
                    }

                    /// <summary>
                    /// Lasers have the longest range of all beam weapons due to their high damage, normal 10,000km factor and weapon range tech.
                    /// </summary>
                    m_oRange = (float)m_lDamage[0] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                    /// <summary>
                    /// Lasers require 1 unit of power for every unit of damage that they do.
                    /// </summary>
                    m_oPowerRequirement = m_lDamage[0];

                    /// <summary>
                    /// Subsequent entries up to Wavelength * 10k do full damage, after that the value is:
                    /// FullDamage * ( Wavelength / RangeIncrement Tick) with a minimum of 1 over range.
                    /// </summary>
                    /// 
                    RangeIncrement = (m_oWeaponRangeTech + 1) * m_lDamage[0];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Beam;
                    break;

                case ComponentTypeTN.AdvLaser:
                    size = (float)Math.Round(Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech] * Reduction);
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech]);

                    /// <summary>
                    /// Advanced lasers do more damage per unit of power than regular lasers.
                    /// </summary>
                    m_oPowerRequirement = Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];

                    /// <summary>
                    /// Have to modify capacitor by size reduction values.
                    /// </summary>
                    if (Reduction == 0.75f)
                        m_oWeaponCapacitor = m_oWeaponCapacitor / 4.0f;
                    else if (Reduction == 0.5f)
                        m_oWeaponCapacitor = m_oWeaponCapacitor / 20.0f;

                    /// <summary>
                    /// Damage, Size, and Range are all modified by spinal mounting:
                    /// </summary>
                    switch (MType)
                    {
                        case MountType.Spinal:
                            size = (float)Math.Round(size * 1.25f);
                            m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 1.5f);
                            m_oPowerRequirement = (ushort)Math.Round((float)m_oPowerRequirement * 1.5f);
                            break;
                        case MountType.AdvancedSpinal:
                            size = (float)Math.Round(size * 1.5f);
                            m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 2.0f);
                            m_oPowerRequirement = (ushort)Math.Round((float)m_oPowerRequirement * 2.0f);
                            break;
                    }

                    m_oRange = (float)m_lDamage[0] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                    RangeIncrement = (m_oWeaponRangeTech + 1) * m_lDamage[0];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Beam;
                    break;

                /// <summary>
                /// Plasmas are essentially cheaper infared lasers.
                /// </summary>
                case ComponentTypeTN.Plasma:
                    m_oWeaponRangeTech = 0;

                    /// <summary>
                    /// I Suspect that size is 3.2cm per HS but am just using a table for now. No reductions for plasma.
                    /// </summary>
                    size = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];

                    /// <summary>
                    /// Plasma carronades have the same range as an infared laser of equal size.
                    /// </summary>
                    m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                    /// <summary>
                    /// The first entry in the damage table is max damage at point blank(0-10k range) damage.
                    /// </summary>
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]);

                    /// <summary>
                    /// Plasmas require 1 unit of power for every unit of damage that they do.
                    /// </summary>
                    m_oPowerRequirement = m_lDamage[0];

                    /// <summary>
                    /// Subsequent entries up to Wavelength * 10k do full damage, after that the value is:
                    /// FullDamage * ( Wavelength / RangeIncrement Tick) with a minimum of 1 over range.
                    /// </summary>
                    /// 
                    RangeIncrement = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Plasma;
                    break;

                case ComponentTypeTN.AdvPlasma:
                    m_oWeaponRangeTech = 0;
                    size = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech] * 10000.0f * (float)(m_oWeaponRangeTech + 1);
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech]);
                    m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                    RangeIncrement = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Plasma;
                    break;

                /// <summary>
                /// Railguns have a higher damage than lasers of equal size, though it is spread out over many hits.
                /// Likewise railguns are not suitable for turrets, lastly railguns don't have the full tech progression that lasers have.
                /// Railguns and especially advanced railguns are also power efficient as far as the damage that they do.
                /// </summary>
                case ComponentTypeTN.Rail:
                    m_oShotCount = 4;

                    size = (float)Constants.BeamWeaponTN.RailGunSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 10000.0f * (m_oWeaponRangeTech + 1);
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech]);
                    m_oPowerRequirement = (ushort)(Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 3);
                    RangeIncrement = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Kinetic;
                    break;

                /// <summary>
                /// Only difference here is 1 more shot.
                /// </summary>
                case ComponentTypeTN.AdvRail:
                    m_oShotCount = 5;

                    size = (float)Constants.BeamWeaponTN.RailGunSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 10000.0f * (m_oWeaponRangeTech + 1);
                    m_lDamage.Add((ushort)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech]);
                    m_oPowerRequirement = (ushort)(Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 3);
                    RangeIncrement = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech];
                    CalcDamageTable(RangeIncrement);

                    m_oDamageType = DamageTypeTN.Kinetic;
                    break;

                /// <summary>
                /// Mesons have half the range that lasers have, and only do 1 damage, but always pass through armor and shields.
                /// </summary>
                case ComponentTypeTN.Meson:

                    size = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 5000.0f * (float)(m_oWeaponRangeTech + 1);

                    m_lDamage.Add(1);
                    m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                    RangeIncrement = (((m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]) / 2);
                    for (int loop = 1; loop < RangeIncrement; loop++)
                    {
                        m_lDamage.Add(1);
                    }
                    m_lDamage.Add(0);

                    m_oDamageType = DamageTypeTN.Meson;
                    break;

                /// <summary>
                /// Microwaves do electronic only damage, though they do triple against shields. this isn't very useful though as they don't do triple normal laser damage vs shields, just 3.
                /// They share 1/2 range with mesons, but can't be turreted.
                /// </summary>
                case ComponentTypeTN.Microwave:

                    size = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 5000.0f * (float)(m_oWeaponRangeTech + 1);

                    m_lDamage.Add(1);
                    m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];

                    RangeIncrement = (((m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]) / 2);
                    for (int loop = 1; loop < RangeIncrement; loop++)
                    {
                        m_lDamage.Add(1);
                    }
                    m_lDamage.Add(0);

                    m_oDamageType = DamageTypeTN.Microwave;
                    break;

                /// <summary>
                /// Particle Beams suffer no range dissipation so will out damage lasers at their maximum range, but are shorter ranged than lasers.
                /// WeaponSizeTech for particle beams is their warhead strength, not any focal lense size as with lasers.
                /// </summary>
                case ComponentTypeTN.Particle:

                    size = (float)Constants.BeamWeaponTN.ParticleSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech] * 10000.0f;
                    m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.ParticlePower[m_oWeaponSizeTech];

                    m_lDamage.Add(Constants.BeamWeaponTN.ParticleDamage[m_oWeaponSizeTech]);
                    RangeIncrement = Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech];
                    for (int loop = 1; loop < RangeIncrement; loop++)
                    {
                        m_lDamage.Add(Constants.BeamWeaponTN.ParticleDamage[m_oWeaponSizeTech]);
                    }
                    m_lDamage.Add(0);

                    m_oDamageType = DamageTypeTN.Kinetic;
                    break;

                /// <summary>
                /// More damage is the only change for advanced particle beams.
                /// </summary>
                case ComponentTypeTN.AdvParticle:

                    size = (float)Constants.BeamWeaponTN.ParticleSize[m_oWeaponSizeTech];
                    m_oRange = (float)Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech] * 10000.0f;
                    m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.ParticlePower[m_oWeaponSizeTech];

                    m_lDamage.Add(Constants.BeamWeaponTN.AdvancedParticleDamage[m_oWeaponSizeTech]);
                    RangeIncrement = Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech];
                    for (int loop = 1; loop < RangeIncrement; loop++)
                    {
                        m_lDamage.Add(Constants.BeamWeaponTN.AdvancedParticleDamage[m_oWeaponSizeTech]);
                    }
                    m_lDamage.Add(0);

                    m_oDamageType = DamageTypeTN.Kinetic;
                    break;

                /// <summary>
                /// Gauss Cannons differ substantially from other beam weapons. Size is determined directly from a size vs accuracy choice.
                /// Likewise capacitor refers to shotcount rather than any capacitor technology.
                /// </summary>
                case ComponentTypeTN.Gauss:
                    size = Constants.BeamWeaponTN.GaussSize[m_oWeaponSizeTech];
                    m_oRange = (m_oWeaponRangeTech + 1) * 10000.0f;
                    m_oShotCount = Constants.BeamWeaponTN.GaussShots[CapacitorTech];
                    m_oBaseAccuracy = Constants.BeamWeaponTN.GaussAccuracy[m_oWeaponSizeTech];
                    m_oPowerRequirement = 0;
                    m_lDamage.Add(1);
                    RangeIncrement = (m_oWeaponRangeTech + 1);
                    for (int loop = 1; loop < RangeIncrement; loop++)
                    {
                        m_lDamage.Add(1);
                    }
                    m_lDamage.Add(0);

                    m_oDamageType = DamageTypeTN.Kinetic;
                    break;
            }

            /// <summary>
            /// Gauss cannons just have to be different.
            /// </summary>
            if (componentType != ComponentTypeTN.Gauss)
            {
                htk = (byte)(size / 2.0f);
                crew = (byte)(size * 2.0f);

                /// <summary>
                /// This isn't how aurora does cost, I couldn't quite figure that out. seems like it might be a table.
                /// well in any event cost is simply the hit to kill * weapon tech level + 1 * weapon capacitor tech level + 1.
                /// </summary>
                cost = (decimal)((int)htk * (int)(m_oWeaponRangeTech + 1) * (int)(m_oWeaponCapacitor + 1));

                m_oROF = (ushort)((ushort)Math.Ceiling((float)((float)m_oPowerRequirement / (float)m_oWeaponCapacitor)) * 5);
            }
            else
            {
                /// <summary>
                /// Gauss data here.
                /// </summary>
                if (size == 6.0 || size == 5.0 || size == 4.0)
                    htk = 2;
                else if (size >= 1.0)
                    htk = 1;
                else
                    htk = 0;

                crew = (byte)(size * 2.0f);
                cost = (decimal)((size * 2.0f) * (float)(m_oWeaponRangeTech + 1) * (float)(m_oWeaponCapacitor + 1));

                m_oROF = 5;
            }

            minerialsCost = new decimal[Constants.Minerals.NO_OF_MINERIALS];
            for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
            {
                minerialsCost[mineralIterator] = 0;
            }
            switch (componentType)
            {
                case ComponentTypeTN.Laser:
                case ComponentTypeTN.AdvLaser:
                case ComponentTypeTN.Plasma:
                case ComponentTypeTN.AdvPlasma:
                case ComponentTypeTN.Particle:
                case ComponentTypeTN.AdvParticle:
                case ComponentTypeTN.Meson:
                case ComponentTypeTN.Microwave: //20%D 20%B 60%C
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Duranium] = cost * 0.2m;
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Boronide] = cost * 0.2m;
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Corundium] = cost * 0.6m;
                    break;

                case ComponentTypeTN.Rail:
                case ComponentTypeTN.AdvRail: //20%D 20%B 60%N
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Duranium] = cost * 0.2m;
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Boronide] = cost * 0.2m;
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Neutronium] = cost * 0.6m;
                    break;

                case ComponentTypeTN.Gauss: //100%V
                    minerialsCost[(int)Constants.Minerals.MinerialNames.Vendarite] = cost;
                    break;
            }


            isMilitary = true;
            isObsolete = false;
            isDivisible = false;
            isSalvaged = false;
            isElectronic = false;
        }
 public MountRewardData(MountType mount) : base(Reward.Type.MOUNT)
 {
     this.Mount = mount;
 }
Exemple #25
0
        public static async Task <Guid[]> GerDeviceRulesIdList(this ApplicationDbContext _dbContext, Guid devid, MountType mountType)
        {
            var rules = await  GerDeviceRulesList(_dbContext, devid, mountType);

            return(rules?.Select(xc => xc.FlowRule.RuleId).ToArray());
        }
Exemple #26
0
 internal MountInfo(string directory, string block, MountType type)
 {
     this.directory = directory;
     this.block     = block;
     this.type      = type;
 }
Exemple #27
0
	/// <summary>
	/// Gets the mount.
	/// </summary>
	/// <returns>The mount.</returns>
	/// <param name="type">Type.</param>
	public Transform	GetMount(MountType type)
	{
		if (type == MountType.None)
			return transform;

		return m_dMount[type];
	}
        private async Task ExecFlowRules(ApplicationMessageNotConsumedEventArgs e, Device _dev, MountType mount)
        {
            var rules = await _caching.GetAsync($"ruleid_{_dev.Id}_raw", async() =>
            {
                using (var scope = _scopeFactor.CreateScope())
                    using (var _dbContext = scope.ServiceProvider.GetRequiredService <ApplicationDbContext>())
                    {
                        var guids = await _dbContext.GerDeviceRulesIdList(_dev.Id, mount);
                        return(guids);
                    }
            }
                                                , TimeSpan.FromSeconds(_settings.RuleCachingExpiration));

            if (rules.HasValue)
            {
                var obj = new { e.ApplicationMessage.Topic, Payload = Convert.ToBase64String(e.ApplicationMessage.Payload), e.SenderClientId };
                rules.Value.ToList().ForEach(async g =>
                {
                    _logger.LogInformation($"{e.SenderClientId}的数据{e.ApplicationMessage.Topic}通过规则链{g}进行处理。");
                    await _flowRuleProcessor.RunFlowRules(g, obj, _dev.Id, EventType.Normal, null);
                });
            }
            else
            {
                _logger.LogInformation($"{e.SenderClientId}的数据{e.ApplicationMessage.Topic}不符合规范, 也无相关规则链处理。");
            }
        }
        //void PushFile();
        //void PullFile();
        /// <summary>
        /// Mounts connected Android device's file system as specified
        /// </summary>
        /// <param name="type">The desired <see cref="MountType"/> (RW or RO)</param>
        /// <returns>True if remount is successful, False if remount is unsuccessful</returns>
        /// <example>The following example shows how you can mount the file system as Read-Writable or Read-Only
        /// <code>
        /// // This example demonstrates mounting the Android device's file system as Read-Writable
        /// using System;
        /// using RegawMOD.Android;
        /// 
        /// class Program
        /// {
        ///     static void Main(string[] args)
        ///     {
        ///         AndroidController android = AndroidController.Instance;
        ///         Device device;
        ///         
        ///         Console.WriteLine("Waiting For Device...");
        ///         android.WaitForDevice(); //This will wait until a device is connected to the computer
        ///         device = android.ConnectedDevices[0]; //Sets device to the first Device in the collection
        ///
        ///         Console.WriteLine("Connected Device - {0}", device.SerialNumber);
        ///
        ///         Console.WriteLine("Mounting System as RW...");
        ///     	Console.WriteLine("Mount success? - {0}", device.RemountSystem(MountType.RW));
        ///     }
        /// }
        /// 
        ///	// The example displays the following output (if mounting is successful):
        ///	//		Waiting For Device...
        ///	//		Connected Device - {serial # here}
        ///	//		Mounting System as RW...
        ///	//		Mount success? - true
        /// </code>
        /// </example>
        public bool RemountSystem(MountType type)
        {
            if (!this.device.HasRoot)
                return false;

            AdbCommand adbCmd = Adb.FormAdbShellCommand(this.device, true, "mount", string.Format("-o remount,{0} -t yaffs2 {1} /system", type.ToString().ToLower(), this.systemMount.Block));
            Adb.ExecuteAdbCommandNoReturn(adbCmd);

            UpdateMountPoints();

            if (this.systemMount.MountType == type)
                return true;

            return false;
        }
 public MountDeletedEventArgs(string path, MountType type)
 {
     Path = path;
     Type = type;
 }
Exemple #31
0
        /// <summary>
        /// Constructor for all beam weapon types.
        /// </summary>
        /// <param name="Title">Name of the beam weapon, user entered string, or default string.</param>
        /// <param name="Type">What type of beam weapon this is, note that componentTypeTN encompasses much more than beam weapon types, don't give those values to this function.</param>
        /// <param name="SizeTech">Every beam weapon either has a calibre size, except for particle beams, which use warhead strength, and gauss which give a rate of fire. All use this variable.</param>
        /// <param name="RangeTech">Every beam weapon has a range tech except for plasma carronades which do not have any way to increase range or decrease damage falloff.</param>
        /// <param name="CapacitorTech">Every beam weapon has a capacitor tech associated with it except gauss. Shotcount tech for gauss.</param>
        /// <param name="Reduction">Lasers and Gauss both have size reduction capabilities, though with drawbacks for both types: recharge rate and accuracy respectively.</param>
        public BeamDefTN(String Title, ComponentTypeTN Type, byte SizeTech, byte RangeTech, byte CapacitorTech, float Reduction, MountType MType = MountType.Standard)
        {
#warning function has beam weapon range related magic numbers and others
            if (Type < ComponentTypeTN.Rail || Type > ComponentTypeTN.AdvParticle)
            {
                /// <summary>
                /// Error, bad ID passed to BeamDefTN.
                /// </summary>
                return;
            }
            Id            = Guid.NewGuid();
            componentType = Type;

            Name = Title;
            m_oWeaponSizeTech      = SizeTech;
            m_oWeaponRangeTech     = RangeTech;
            m_oWeaponCapacitorTech = CapacitorTech;
            m_oWeaponCapacitor     = Constants.BeamWeaponTN.Capacitor[CapacitorTech];
            m_oWMType = MType;

            m_oShotCount    = 1;
            m_oBaseAccuracy = 1.0f;

            m_lDamage = new BindingList <ushort>();

            int RangeIncrement;

            switch (componentType)
            {
            /// <summary>
            /// Laser is the the most basic jack of all trade beam weapon.
            /// </summary>
            case ComponentTypeTN.Laser:

                /// <summary>
                /// I Suspect that size is 3.2cm per HS but am just using a table for now.
                /// </summary>
                size = (float)Math.Round(Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech] * Reduction);

                /// <summary>
                /// The first entry in the damage table is max damage at point blank(0-10k range) damage.
                /// </summary>
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]);

                /// <summary>
                /// Have to modify capacitor by size reduction values.
                /// </summary>
                if (Reduction == 0.75f)
                {
                    m_oWeaponCapacitor = m_oWeaponCapacitor / 4.0f;
                }
                else if (Reduction == 0.5f)
                {
                    m_oWeaponCapacitor = m_oWeaponCapacitor / 20.0f;
                }

                /// <summary>
                /// Damage, Size, and Range are all modified by spinal mounting:
                /// </summary>
                switch (m_oWMType)
                {
                case MountType.Spinal:
                    size         = (float)Math.Round(size * 1.25f);
                    m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 1.5f);
                    break;

                case MountType.AdvancedSpinal:
                    size         = (float)Math.Round(size * 1.5f);
                    m_lDamage[0] = (ushort)Math.Round((float)m_lDamage[0] * 2.0f);
                    break;
                }

                /// <summary>
                /// Lasers have the longest range of all beam weapons due to their high damage, normal 10,000km factor and weapon range tech.
                /// </summary>
                m_oRange = (float)m_lDamage[0] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                /// <summary>
                /// Lasers require 1 unit of power for every unit of damage that they do.
                /// </summary>
                m_oPowerRequirement = m_lDamage[0];

                /// <summary>
                /// Subsequent entries up to Wavelength * 10k do full damage, after that the value is:
                /// FullDamage * ( Wavelength / RangeIncrement Tick) with a minimum of 1 over range.
                /// </summary>
                ///
                RangeIncrement = (m_oWeaponRangeTech + 1) * m_lDamage[0];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Beam;
                break;

            case ComponentTypeTN.AdvLaser:
                size = (float)Math.Round(Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech] * Reduction);
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech]);

                /// <summary>
                /// Advanced lasers do more damage per unit of power than regular lasers.
                /// </summary>
                m_oPowerRequirement = Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];

                /// <summary>
                /// Have to modify capacitor by size reduction values.
                /// </summary>
                if (Reduction == 0.75f)
                {
                    m_oWeaponCapacitor = m_oWeaponCapacitor / 4.0f;
                }
                else if (Reduction == 0.5f)
                {
                    m_oWeaponCapacitor = m_oWeaponCapacitor / 20.0f;
                }

                /// <summary>
                /// Damage, Size, and Range are all modified by spinal mounting:
                /// </summary>
                switch (MType)
                {
                case MountType.Spinal:
                    size                = (float)Math.Round(size * 1.25f);
                    m_lDamage[0]        = (ushort)Math.Round((float)m_lDamage[0] * 1.5f);
                    m_oPowerRequirement = (ushort)Math.Round((float)m_oPowerRequirement * 1.5f);
                    break;

                case MountType.AdvancedSpinal:
                    size                = (float)Math.Round(size * 1.5f);
                    m_lDamage[0]        = (ushort)Math.Round((float)m_lDamage[0] * 2.0f);
                    m_oPowerRequirement = (ushort)Math.Round((float)m_oPowerRequirement * 2.0f);
                    break;
                }

                m_oRange = (float)m_lDamage[0] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                RangeIncrement = (m_oWeaponRangeTech + 1) * m_lDamage[0];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Beam;
                break;

            /// <summary>
            /// Plasmas are essentially cheaper infared lasers.
            /// </summary>
            case ComponentTypeTN.Plasma:
                m_oWeaponRangeTech = 0;

                /// <summary>
                /// I Suspect that size is 3.2cm per HS but am just using a table for now. No reductions for plasma.
                /// </summary>
                size = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];

                /// <summary>
                /// Plasma carronades have the same range as an infared laser of equal size.
                /// </summary>
                m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 10000.0f * (float)(m_oWeaponRangeTech + 1);

                /// <summary>
                /// The first entry in the damage table is max damage at point blank(0-10k range) damage.
                /// </summary>
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]);

                /// <summary>
                /// Plasmas require 1 unit of power for every unit of damage that they do.
                /// </summary>
                m_oPowerRequirement = m_lDamage[0];

                /// <summary>
                /// Subsequent entries up to Wavelength * 10k do full damage, after that the value is:
                /// FullDamage * ( Wavelength / RangeIncrement Tick) with a minimum of 1 over range.
                /// </summary>
                ///
                RangeIncrement = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Plasma;
                break;

            case ComponentTypeTN.AdvPlasma:
                m_oWeaponRangeTech = 0;
                size     = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                m_oRange = (float)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech] * 10000.0f * (float)(m_oWeaponRangeTech + 1);
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech]);
                m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                RangeIncrement      = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.AdvancedLaserDamage[m_oWeaponSizeTech];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Plasma;
                break;

            /// <summary>
            /// Railguns have a higher damage than lasers of equal size, though it is spread out over many hits.
            /// Likewise railguns are not suitable for turrets, lastly railguns don't have the full tech progression that lasers have.
            /// Railguns and especially advanced railguns are also power efficient as far as the damage that they do.
            /// </summary>
            case ComponentTypeTN.Rail:
                m_oShotCount = 4;

                size     = (float)Constants.BeamWeaponTN.RailGunSize[m_oWeaponSizeTech];
                m_oRange = (float)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 10000.0f * (m_oWeaponRangeTech + 1);
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech]);
                m_oPowerRequirement = (ushort)(Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 3);
                RangeIncrement      = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Kinetic;
                break;

            /// <summary>
            /// Only difference here is 1 more shot.
            /// </summary>
            case ComponentTypeTN.AdvRail:
                m_oShotCount = 5;

                size     = (float)Constants.BeamWeaponTN.RailGunSize[m_oWeaponSizeTech];
                m_oRange = (float)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 10000.0f * (m_oWeaponRangeTech + 1);
                m_lDamage.Add((ushort)Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech]);
                m_oPowerRequirement = (ushort)(Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech] * 3);
                RangeIncrement      = (m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.RailGunDamage[m_oWeaponSizeTech];
                CalcDamageTable(RangeIncrement);

                m_oDamageType = DamageTypeTN.Kinetic;
                break;

            /// <summary>
            /// Mesons have half the range that lasers have, and only do 1 damage, but always pass through armor and shields.
            /// </summary>
            case ComponentTypeTN.Meson:

                size     = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 5000.0f * (float)(m_oWeaponRangeTech + 1);

                m_lDamage.Add(1);
                m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];
                RangeIncrement      = (((m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]) / 2);
                for (int loop = 1; loop < RangeIncrement; loop++)
                {
                    m_lDamage.Add(1);
                }
                m_lDamage.Add(0);

                m_oDamageType = DamageTypeTN.Meson;
                break;

            /// <summary>
            /// Microwaves do electronic only damage, though they do triple against shields. this isn't very useful though as they don't do triple normal laser damage vs shields, just 3.
            /// They share 1/2 range with mesons, but can't be turreted.
            /// </summary>
            case ComponentTypeTN.Microwave:

                size     = (float)Constants.BeamWeaponTN.LaserSize[m_oWeaponSizeTech];
                m_oRange = (float)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech] * 5000.0f * (float)(m_oWeaponRangeTech + 1);

                m_lDamage.Add(1);
                m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech];

                RangeIncrement = (((m_oWeaponRangeTech + 1) * Constants.BeamWeaponTN.LaserDamage[m_oWeaponSizeTech]) / 2);
                for (int loop = 1; loop < RangeIncrement; loop++)
                {
                    m_lDamage.Add(1);
                }
                m_lDamage.Add(0);

                m_oDamageType = DamageTypeTN.Microwave;
                break;

            /// <summary>
            /// Particle Beams suffer no range dissipation so will out damage lasers at their maximum range, but are shorter ranged than lasers.
            /// WeaponSizeTech for particle beams is their warhead strength, not any focal lense size as with lasers.
            /// </summary>
            case ComponentTypeTN.Particle:

                size                = (float)Constants.BeamWeaponTN.ParticleSize[m_oWeaponSizeTech];
                m_oRange            = (float)Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech] * 10000.0f;
                m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.ParticlePower[m_oWeaponSizeTech];

                m_lDamage.Add(Constants.BeamWeaponTN.ParticleDamage[m_oWeaponSizeTech]);
                RangeIncrement = Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech];
                for (int loop = 1; loop < RangeIncrement; loop++)
                {
                    m_lDamage.Add(Constants.BeamWeaponTN.ParticleDamage[m_oWeaponSizeTech]);
                }
                m_lDamage.Add(0);

                m_oDamageType = DamageTypeTN.Kinetic;
                break;

            /// <summary>
            /// More damage is the only change for advanced particle beams.
            /// </summary>
            case ComponentTypeTN.AdvParticle:

                size                = (float)Constants.BeamWeaponTN.ParticleSize[m_oWeaponSizeTech];
                m_oRange            = (float)Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech] * 10000.0f;
                m_oPowerRequirement = (ushort)Constants.BeamWeaponTN.ParticlePower[m_oWeaponSizeTech];

                m_lDamage.Add(Constants.BeamWeaponTN.AdvancedParticleDamage[m_oWeaponSizeTech]);
                RangeIncrement = Constants.BeamWeaponTN.ParticleRange[m_oWeaponRangeTech];
                for (int loop = 1; loop < RangeIncrement; loop++)
                {
                    m_lDamage.Add(Constants.BeamWeaponTN.AdvancedParticleDamage[m_oWeaponSizeTech]);
                }
                m_lDamage.Add(0);

                m_oDamageType = DamageTypeTN.Kinetic;
                break;

            /// <summary>
            /// Gauss Cannons differ substantially from other beam weapons. Size is determined directly from a size vs accuracy choice.
            /// Likewise capacitor refers to shotcount rather than any capacitor technology.
            /// </summary>
            case ComponentTypeTN.Gauss:
                size                = Constants.BeamWeaponTN.GaussSize[m_oWeaponSizeTech];
                m_oRange            = (m_oWeaponRangeTech + 1) * 10000.0f;
                m_oShotCount        = Constants.BeamWeaponTN.GaussShots[CapacitorTech];
                m_oBaseAccuracy     = Constants.BeamWeaponTN.GaussAccuracy[m_oWeaponSizeTech];
                m_oPowerRequirement = 0;
                m_lDamage.Add(1);
                RangeIncrement = (m_oWeaponRangeTech + 1);
                for (int loop = 1; loop < RangeIncrement; loop++)
                {
                    m_lDamage.Add(1);
                }
                m_lDamage.Add(0);

                m_oDamageType = DamageTypeTN.Kinetic;
                break;
            }

            /// <summary>
            /// Gauss cannons just have to be different.
            /// </summary>
            if (componentType != ComponentTypeTN.Gauss)
            {
                htk  = (byte)(size / 2.0f);
                crew = (byte)(size * 2.0f);

                /// <summary>
                /// This isn't how aurora does cost, I couldn't quite figure that out. seems like it might be a table.
                /// well in any event cost is simply the hit to kill * weapon tech level + 1 * weapon capacitor tech level + 1.
                /// </summary>
                cost = (decimal)((int)htk * (int)(m_oWeaponRangeTech + 1) * (int)(m_oWeaponCapacitor + 1));

                m_oROF = (ushort)((ushort)Math.Ceiling((float)((float)m_oPowerRequirement / (float)m_oWeaponCapacitor)) * 5);
            }
            else
            {
                /// <summary>
                /// Gauss data here.
                /// </summary>
                if (size == 6.0 || size == 5.0 || size == 4.0)
                {
                    htk = 2;
                }
                else if (size >= 1.0)
                {
                    htk = 1;
                }
                else
                {
                    htk = 0;
                }

                crew = (byte)(size * 2.0f);
                cost = (decimal)((size * 2.0f) * (float)(m_oWeaponRangeTech + 1) * (float)(m_oWeaponCapacitor + 1));

                m_oROF = 5;
            }

            minerialsCost = new decimal[Constants.Minerals.NO_OF_MINERIALS];
            for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
            {
                minerialsCost[mineralIterator] = 0;
            }
            switch (componentType)
            {
            case ComponentTypeTN.Laser:
            case ComponentTypeTN.AdvLaser:
            case ComponentTypeTN.Plasma:
            case ComponentTypeTN.AdvPlasma:
            case ComponentTypeTN.Particle:
            case ComponentTypeTN.AdvParticle:
            case ComponentTypeTN.Meson:
            case ComponentTypeTN.Microwave:     //20%D 20%B 60%C
                minerialsCost[(int)Constants.Minerals.MinerialNames.Duranium]  = cost * 0.2m;
                minerialsCost[(int)Constants.Minerals.MinerialNames.Boronide]  = cost * 0.2m;
                minerialsCost[(int)Constants.Minerals.MinerialNames.Corundium] = cost * 0.6m;
                break;

            case ComponentTypeTN.Rail:
            case ComponentTypeTN.AdvRail:     //20%D 20%B 60%N
                minerialsCost[(int)Constants.Minerals.MinerialNames.Duranium]   = cost * 0.2m;
                minerialsCost[(int)Constants.Minerals.MinerialNames.Boronide]   = cost * 0.2m;
                minerialsCost[(int)Constants.Minerals.MinerialNames.Neutronium] = cost * 0.6m;
                break;

            case ComponentTypeTN.Gauss:     //100%V
                minerialsCost[(int)Constants.Minerals.MinerialNames.Vendarite] = cost;
                break;
            }


            isMilitary   = true;
            isObsolete   = false;
            isDivisible  = false;
            isSalvaged   = false;
            isElectronic = false;
        }
Exemple #32
0
 public ContainerBuilder MountVolume(string name, string fqContainerPath, MountType access)
 {
     _config.CreateParams.Volumes =
         _config.CreateParams.Volumes.ArrayAdd($"{name}:{fqContainerPath}:{access.ToDocker()}");
     return(this);
 }
Exemple #33
0
	/// <summary>
	/// Bind the specified type and bind.
	/// </summary>
	/// <param name="type">Type.</param>
	/// <param name="bind">Bind.</param>
	public void 		Bind(MountType type, Object resource, float fDuration,  bool bFollow, string szBindName)
	{
		Transform mount = GetMount(type);
		if (mount)
		{
			string szAppBindName = string.IsNullOrEmpty(szBindName) ? resource.name : szBindName;

			// destroy old bind object
			Transform bind = mount.FindChild(szAppBindName);
			if (bind)
				GameObject.Destroy(bind);

			// create a new bind object
			GameObject goBind = GameObject.Instantiate(resource) as GameObject;
			if (!goBind)
				throw new System.NullReferenceException("Can't instantiate resource " + resource.name);

			goBind.transform.name		= szAppBindName;
			goBind.transform.position	= mount.position;
			goBind.transform.rotation	= mount.rotation;
			
			if (bFollow)
				goBind.transform.parent = mount;

			// wait destroy
			if (fDuration > 0.0f)
			{
				StartCoroutine(OnAppBind(goBind, fDuration));
			}
		}
	}
Exemple #34
0
	public static void setMountType (MountType newMountType) {
		mountType = newMountType;
	}
Exemple #35
0
    //This static method indicates that the gesture is captured on the desired area.
    public static bool capturedSide(Hand hand, UseArea useArea, MountType mountType)
    {
        if (mountType == MountType.TableMount) // If application mount type is table mount.
        {                                      // left, right : x, up,down : z
            //Modified coordinate to relative axis of unity camera.
            Vector  position      = hand.PalmPosition;
            Vector3 unityPosition = position.ToUnity(); // Set coordinate value to unity scale.
            Vector3 toPos         = new Vector3(((unityPosition.x + 150.0f) / 300.0f), (unityPosition.y / 300.0f), ((unityPosition.z + 150.0f) / 300.0f));
            Vector3 pos           = Camera.main.ViewportToWorldPoint(toPos);
            Vector3 tempos        = Camera.main.WorldToViewportPoint(pos);//From now, coordinate values are setted range(0~1)
            //----------------------------------------------------

            // Check condition of using area.
            switch (useArea)
            {
            case UseArea.All:
                return(true);

            case UseArea.Left:
                if (tempos.x < 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Right:
                if (tempos.x >= 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Up:
                if (tempos.y >= 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Down:
                if (tempos.y < 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }
        // If application mount type is head mount.
        // left, right : x, up,down : y
        else
        {
            //Modified coordinate to relative axis of unity camera.
            //And change coordinate mode table mount to head mount.
            Vector  position      = hand.PalmPosition;
            Vector3 unityPosition = position.ToUnity();
            Vector3 toPos         = new Vector3(1 - ((unityPosition.x + 150.0f) / 300.0f), ((unityPosition.z + 150.0f) / 300.0f), (unityPosition.y / 300.0f));
            Vector3 pos           = Camera.main.ViewportToWorldPoint(toPos);
            Vector3 tempos        = Camera.main.WorldToViewportPoint(pos);
            //------------------------------------------------------

            switch (useArea)
            {
            case UseArea.All:
                return(true);

            case UseArea.Left:
                if (tempos.x < 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Right:
                if (tempos.x >= 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Up:
                if (tempos.y >= 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case UseArea.Down:
                if (tempos.y < 0.5)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }
    }
 internal MountInfo(string directory, string block, MountType type)
 {
     this.directory = directory;
     this.block = block;
     this.type = type;
 }
Exemple #37
0
	/// <summary>
	/// Determines whether this instance cancel bind the specified type szBindName.
	/// </summary>
	/// <returns><c>true</c> if this instance cancel bind the specified type szBindName; otherwise, <c>false</c>.</returns>
	/// <param name="type">Type.</param>
	/// <param name="szBindName">Size bind name.</param>
	public void 		CancelBind(MountType type, string szBindName)
	{
		Transform mount = GetMount (type);
		if (mount)
		{
			Transform bind = mount.FindChild(szBindName);
			if (bind)
			{
				GameObject.Destroy(bind.gameObject);
			}
		}
	}