Exemple #1
0
        /// <summary>
        /// Changes the tooltip info given a certain key
        /// </summary>
        /// <param name="key">Key of the unit/building to look up in the database</param>
        public void ChangeTooltip(string key)
        {
            UnitInfo unitInfo = UnitDatabase.GetInfo(key);

            this.title.text       = unitInfo.Name;
            this.description.text = $"Sand: {unitInfo.SandCost}\nCandy: {unitInfo.CandyCost}\n{unitInfo.Description}";
        }
 public async Task <IHttpActionResult> GetWeb_AccessUserReport(string userName, string password, string ace, string group, string user)
 {
     if (UnitDatabase.CreateConection(userName, password, "Config", "", ""))
     {
         if (!string.IsNullOrEmpty(ace) || !string.IsNullOrEmpty(group) || !string.IsNullOrEmpty(user))
         {
             string sql = string.Format(@"declare @ace nvarchar(5), @group int , @username nvarchar(20)
                                          set @ace = '{0}'
                                          set @group = {1}
                                          set @username = '******'
                                          select 'TrzIKala'as Code , [dbo].[Web_RprtTrs](@group,@ace,@username,'TrzIKala') as Trs
                                          union all
                                          select 'TrzIKalaExf'as Code , [dbo].[Web_RprtTrs](@group,@ace,@username,'TrzIKalaExf') as Trs
                                          union all
                                          select 'IDocR'as Code , [dbo].[Web_RprtTrs](@group,@ace,@username,'IDocR') as Trs
                                          union all
                                          select 'FDocR'as Code , [dbo].[Web_RprtTrs](@group,@ace,@username,'FDocR') as Trs
                                          union all
                                          select 'TrzAcc' as Code, [dbo].[Web_RprtTrs](@group, @ace, @username, 'TrzAcc') as Trs"
                                        , ace, group, user);
             var listDB = UnitDatabase.db.Database.SqlQuery <AccessUserReport>(sql).ToList();
             return(Ok(listDB));
         }
     }
     return(null);
 }
    private void ProcessUnitStats()
    {
        m_unitDatabase = FindObjectOfType <UnitDatabase>();
        List <Unit> playerUnits = m_unitDatabase.PlayerUnits;

        ResetStats(playerUnits);
    }
        public async Task <IHttpActionResult> PostWeb_TrzIKalaExf(string userName, string password, string ace, string sal, string group, TrzIExfObject TrzIExfObject)
        {
            if (UnitDatabase.CreateConection(userName, password, ace, sal, group))
            {
                string invCode = UnitPublic.SpiltCodeCama(TrzIExfObject.InvCode);

                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select * FROM  dbo.Web_TrzIKalaExf('{0}', '{1}','{2}') AS TrzIExf where 1 = 1 ",
                                           TrzIExfObject.azTarikh, TrzIExfObject.taTarikh, invCode);

                if (TrzIExfObject.KGruCode != "0")
                {
                    sql += string.Format(" and KGruCode = '{0}' ", TrzIExfObject.KGruCode);
                }

                // sql += UnitPublic.SpiltCodeAnd("InvCode", TrzIExfObject.InvCode);
                sql += UnitPublic.SpiltCodeAnd("KalaCode", TrzIExfObject.KalaCode);

                sql += " order by KalaCode,KalaFileNo,KalaState,KalaExf1,KalaExf2,KalaExf3,KalaExf4,KalaExf5,KalaExf6,KalaExf7,KalaExf8,KalaExf9,KalaExf10,KalaExf11,KalaExf12,KalaExf13,KalaExf14,KalaExf15,InvCode,Tag ";

                var listTrzIExf = UnitDatabase.db.Database.SqlQuery <Web_TrzIKalaExf>(sql);
                return(Ok(listTrzIExf));
            }
            return(null);
        }
Exemple #5
0
    void InitializeData()
    {
        heroDatabase = HeroDatabase.Instance;
        heroDatabase.InitializeHeroDatabase();
        itemDatabase = ItemDatabase.Instance;
        itemDatabase.InitializeItemDatabase();
        buildingDatabase = BuildingDatabase.Instance;
        buildingDatabase.InitializeBuildingDatabase();
        unitDatabase = UnitDatabase.Instance;
        unitDatabase.InitializeUnitDatabase();

        Id          = "";
        heroData    = new HeroBaseData();
        resource    = 0;
        heroState   = 0;
        castleState = 0;

        equipment    = new int[equipNum];
        inventoryId  = new int[invenNum];
        inventoryNum = new int[invenNum];
        skill        = new int[skillNum];
        unit         = new Unit[unitNum];
        createUnit   = new Unit();
        attackUnit   = new Unit[unitNum];
        building     = new int[buildingNum];
        upgrade      = new int[unitNum];

        buildBuilding = buildingNum;
    }
Exemple #6
0
        private static Creep KillableCreep(bool islaneclear)
        {
            var minion = ObjectMgr.GetEntities <Creep>()
                         .Where(creep => creep.IsAlive && me.Distance2D(creep) <= me.GetAttackRange())
                         .OrderBy(creep => creep.Health).DefaultIfEmpty(null).FirstOrDefault();

            double test = 0;

            if (minion != null)
            {
                var missilespeed = GetProjectileSpeed(me);
                var time         = me.IsRanged == false ? 0 : UnitDatabase.GetAttackBackswing(me) + (me.Distance2D(minion) / missilespeed);
                test = time * minion.AttacksPerSecond * minion.DamageAverage;


                Console.WriteLine("test " + test + " time " + time + " distance " + me.Distance2D(minion) / missilespeed);
                if (minion != null && (minion.Health) < GetPhysDamageOnUnit(minion, test))
                {
                    if (me.CanAttack())
                    {
                        return(minion);
                    }
                }
            }
            return(islaneclear == true ? minion : null);
        }
        /// <summary>
        ///     The track.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Track(EventArgs args)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                Drawing.OnDraw -= this.Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (this.Unit.NetworkActivity == this.lastUnitActivity)
            {
                return;
            }

            this.lastUnitActivity = this.Unit.NetworkActivity;
            if (!this.Unit.IsAttacking())
            {
                if (this.CanCancelAttack())
                {
                    return;
                }

                this.lastUnitActivity      = 0;
                this.nextUnitAttackEnd     = 0;
                this.nextUnitAttackRelease = 0;
                return;
            }

            this.nextUnitAttackEnd     = (float)(Utils.TickCount + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.nextUnitAttackRelease = (float)(Utils.TickCount + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
        }
        public async Task <IHttpActionResult> PostWeb_TrzIKala(string ace, string sal, string group, TrzIObject TrzIObject)
        {
            if (UnitDatabase.CreateConection(ace, sal, group))
            {
                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select * FROM  dbo.Web_TrzIKala('{0}', '{1}') AS TrzI where 1 = 1 ",
                                           TrzIObject.azTarikh, TrzIObject.taTarikh);
                if (TrzIObject.InvCode != "0")
                {
                    sql += string.Format(" and InvCode = '{0}' ", TrzIObject.InvCode);
                }

                if (TrzIObject.KGruCode != "0")
                {
                    sql += string.Format(" and KGruCode = '{0}' ", TrzIObject.KGruCode);
                }

                if (TrzIObject.KalaCode != "0")
                {
                    sql += string.Format("and KalaCode = '{0}' ", TrzIObject.KalaCode);
                }

                var listTrzI = UnitDatabase.db.Database.SqlQuery <Web_TrzIKala>(sql);
                return(Ok(listTrzI));
            }
            return(null);
        }
        public async Task <IHttpActionResult> PostWeb_UpdatePriceAnbar(string ace, string sal, string group, long serialnumber)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (UnitDatabase.CreateConection(ace, sal, group))
            {
                try
                {
                    string sql = string.Format(CultureInfo.InvariantCulture,
                                               @"DECLARE	@return_value int
                            EXEC    @return_value = [dbo].[Web_IDocB_SetKalaPrice]
		                            @SerialNumber = {0}
                            SELECT  'Return Value' = @return_value",
                                               serialnumber);
                    int value = UnitDatabase.db.Database.SqlQuery <int>(sql).Single();
                    if (value == 0)
                    {
                        await UnitDatabase.db.SaveChangesAsync();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            string sql1      = string.Format(@"SELECT SerialNumber,BandNo,KalaCode,KalaName,MainUnit,MainUnitName,Amount1,Amount2,Amount3,UnitPrice,TotalPrice,Comm,Up_Flag,DeghatR1,DeghatR2,DeghatR3,DeghatM1,DeghatM2,DeghatM3,DeghatR
                                         FROM Web_IDocB WHERE SerialNumber = {0}", serialnumber);
            var    listIDocB = UnitDatabase.db.Database.SqlQuery <Web_IDocB>(sql1);

            return(Ok(listIDocB));
        }
        public async Task <IHttpActionResult> PostWeb_TestMoveFactor(string ace, string sal, string group, long serialNumber, string ModeCode)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, serialNumber, "", 0, 0);

            if (con == "ok")
            {
                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"DECLARE	@retval nvarchar(250)
                                            EXEC	[dbo].[Web_TestFDoc_Move]
		                                            @serialNumber = {0},
		                                            @MoveToModeCode = '{1}',
		                                            @retval = @retval OUTPUT

                                            SELECT	@retval as N'@retval'"    ,
                                           serialNumber,
                                           ModeCode);
                try
                {
                    var result = UnitDatabase.db.Database.SqlQuery <string>(sql).ToList();
                    return(Ok(result));
                    // return Ok("");
                }
                catch (Exception e)
                {
                    throw;
                }
            }
            return(Ok(con));
        }
Exemple #11
0
        public async Task <IHttpActionResult> DeleteAFI_IDocHi(string ace, string sal, string group, long SerialNumber, string ModeCode)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, SerialNumber, ModeCode == "1" ? "IIDoc" : "IODoc", 3, 0);

            if (con == "ok")
            {
                try
                {
                    string sql = string.Format(@"DECLARE	@return_value int
                                                 EXEC	@return_value = [dbo].[Web_SaveIDoc_Del]
		                                                @SerialNumber = {0}
                                                 SELECT	'Return Value' = @return_value"
                                               , SerialNumber);

                    int value = UnitDatabase.db.Database.SqlQuery <int>(sql).Single();
                    if (value > 0)
                    {
                        await UnitDatabase.db.SaveChangesAsync();
                    }
                }
                catch (Exception e)
                {
                    throw;
                }


                UnitDatabase.SaveLog(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, SerialNumber, ModeCode == "1" ? "IIDoc" : "IODoc", 3, "Y", 0);
                return(Ok(1));
            }
            return(Ok(con));
        }
        private void Track(EventArgs args)
        {
            if (Unit == null || !Unit.IsValid)
            {
                Events.OnUpdate -= Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (Unit.NetworkActivity == lastUnitActivity)
            {
                return;
            }

            lastUnitActivity = Unit.NetworkActivity;
            if (!Unit.IsAttacking())
            {
                if (CanCancelAttack())
                {
                    return;
                }

                lastUnitActivity      = 0;
                nextUnitAttackEnd     = 0;
                nextUnitAttackRelease = 0;
                return;
            }

            nextUnitAttackEnd     = (float)(Utils.TickCount + (UnitDatabase.GetAttackRate(Unit) * 1000));
            nextUnitAttackRelease = (float)(Utils.TickCount + (UnitDatabase.GetAttackPoint(Unit) * 1000));
        }
Exemple #13
0
        public async Task <IHttpActionResult> PostWeb_FDocR(string ace, string sal, string group, FDocRObject FDocRObject)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, 0, "18", 9, 0);

            if (con == "ok")
            {
                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select top(10000)  * FROM  dbo.Web_FDocR('{0}', '{1}','{2}') AS FDocR where 1 = 1 ",
                                           FDocRObject.ModeCode1, FDocRObject.ModeCode2, dataAccount[2]);

                sql += UnitPublic.SpiltCodeAnd("InvCode", FDocRObject.InvCode);
                sql += UnitPublic.SpiltCodeAnd("KGruCode", FDocRObject.KGruCode);
                sql += UnitPublic.SpiltCodeAnd("KalaCode", FDocRObject.KalaCode);
                sql += UnitPublic.SpiltCodeAnd("CustCode", FDocRObject.CustCode);
                sql += UnitPublic.SpiltCodeAnd("OprCode", FDocRObject.OprCode);
                sql += UnitPublic.SpiltCodeAnd("MkzCode", FDocRObject.MkzCode);

                if (FDocRObject.azTarikh != "")
                {
                    sql += string.Format(" and DocDate >= '{0}' ", FDocRObject.azTarikh);
                }

                if (FDocRObject.taTarikh != "")
                {
                    sql += string.Format(" and DocDate <= '{0}' ", FDocRObject.taTarikh);
                }

                var listFDocR = UnitDatabase.db.Database.SqlQuery <Web_FDocR>(sql);
                return(Ok(listFDocR));
            }
            return(Ok(con));
        }
        public async Task <IHttpActionResult> PostWeb_IDocR(string ace, string sal, string group, IDocRObject IDocRObject)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, 0, "24", 9, 0);

            if (con == "ok")
            {
                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select top (10000) * FROM  dbo.Web_IDocR('{0}', '{1}','{2}') AS IDocR where 1 = 1 ",
                                           IDocRObject.azTarikh, IDocRObject.taTarikh, dataAccount[2]);

                sql += UnitPublic.SpiltCodeAnd("InvCode", IDocRObject.InvCode);
                sql += UnitPublic.SpiltCodeAnd("KGruCode", IDocRObject.KGruCode);
                sql += UnitPublic.SpiltCodeAnd("KalaCode", IDocRObject.KalaCode);
                sql += UnitPublic.SpiltCodeAnd("ThvlCode", IDocRObject.ThvlCode);
                sql += UnitPublic.SpiltCodeAnd("OprCode", IDocRObject.OprCode);
                sql += UnitPublic.SpiltCodeAnd("MkzCode", IDocRObject.MkzCode);
                sql += UnitPublic.SpiltCodeAnd("Status", IDocRObject.StatusCode);
                sql += UnitPublic.SpiltCodeAnd("ModeCode", IDocRObject.ModeCode);

                if (IDocRObject.DocNo > 0)
                {
                    sql += " and DocNo = " + IDocRObject.DocNo;
                }

                sql += " order by DocNo ";

                var listIDocR = UnitDatabase.db.Database.SqlQuery <Web_IDocR>(sql);
                return(Ok(listIDocR));
            }
            return(Ok(con));
        }
        public async Task <IHttpActionResult> PostWeb_Krdx(string ace, string sal, string group, KrdxObject KrdxObject)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, 0, "21", 9, 0);

            if (con == "ok")
            {
                string invCode = UnitPublic.SpiltCodeCama(KrdxObject.InvCode);
                string sql     = string.Format(CultureInfo.InvariantCulture,
                                               @"select * from (select top (10000) * FROM  dbo.Web_Krdx('{0}', '{1}',{2},'{3}','{4}','{5}') AS Krdx where 1 = 1 ",
                                               KrdxObject.azTarikh,
                                               KrdxObject.taTarikh,
                                               KrdxObject.Naghl,
                                               KrdxObject.KalaCode,
                                               invCode,
                                               dataAccount[2]);

                sql += UnitPublic.SpiltCodeAnd("KGruCode", KrdxObject.KGruCode);
                sql += UnitPublic.SpiltCodeAnd("ThvlCode", KrdxObject.ThvlCode);
                sql += UnitPublic.SpiltCodeAnd("OprCode", KrdxObject.OprCode);
                sql += UnitPublic.SpiltCodeAnd("MkzCode", KrdxObject.MkzCode);
                sql += UnitPublic.SpiltCodeAnd("Status", KrdxObject.StatusCode);
                sql += UnitPublic.SpiltCodeAnd("ModeCode", KrdxObject.ModeCode);


                sql += "or BodyTag = 0  order by BodyTag,DocNo ";
                sql += " ) as a where VAmount1 is not null";

                var listKrdx = UnitDatabase.db.Database.SqlQuery <Web_Krdx>(sql);
                return(Ok(listKrdx));
            }
            return(Ok(con));
        }
        public ActionResult AddSqlServer(string serverName, string userName, string password)
        {
            //ذخیره اطلاعات اس کیو ال در فایل ای ان ای در سرور
            if (string.IsNullOrEmpty(serverName))
            {
                return(JavaScript(UnitSweet2.ShowMessage(3, "خطا در ورود اطلاعات", "نام سرور را وارد کنید")));
            }
            if (string.IsNullOrEmpty(userName))
            {
                return(JavaScript(UnitSweet2.ShowMessage(3, "خطا در ورود اطلاعات", "نام کاربری را وارد کنید")));
            }
            if (string.IsNullOrEmpty(password))
            {
                return(JavaScript(UnitSweet2.ShowMessage(3, "خطا در ورود اطلاعات", "کلمه عبور را وارد کنید")));
            }
            UnitPublic.MyIniServer.Write("serverName", serverName);
            UnitPublic.MyIniServer.Write("userName", userName);
            UnitPublic.MyIniServer.Write("password", password);
            try
            {
                if (!UnitDatabase.TestSqlServer(false))
                {
                    return(JavaScript(UnitSweet2.ShowMessage(1, "خطا در اتصال", "دوباره سعی کنید")));
                }
                return(JavaScript(UnitSweet2.ShowMessage(0, "ذخیره شد", "")));
            }
            catch (Exception)
            {
                return(JavaScript(UnitSweet2.ShowMessage(1, "خطا در اتصال", "دوباره سعی کنید")));

                throw;
            }
        }
Exemple #17
0
        public void testInit()
        {
            EdataManager dataManager = new EdataManager(NDF_PATH);

            dataManager.ParseEdataFile();
            NdfbinManager everything = dataManager.ReadNdfbin(EVERYTHING_NDFBIN);

            List <NdfObject> unitInstances = everything.GetClass("TUniteAuSolDescriptor").Instances;

            // setup localisation/unites.dic reader
            EdataManager dataManager2 = new EdataManager(ZZ_PATH);

            dataManager2.ParseEdataFile();
            TradManager dict = dataManager2.ReadDictionary(UNITES_DIC);

            // unit icons
            EdataManager zz4File = new EdataManager(ZZ4_PATH);

            zz4File.ParseEdataFile();
            EdataManager iconPackage = zz4File.ReadPackage(ICON_PACKAGE);

            UnitDatabase unitDatabase = new UnitDatabase(unitInstances, dict, iconPackage, PACT_ICONS_DIRPREFIX, NATO_ICONS_DIRPREFIX);

            List <String> countries = unitDatabase.getAllCountries();

            CollectionAssert.AllItemsAreUnique(countries);
            Assert.IsTrue(countries.Count > 0);
        }
        /// <summary>
        ///     The attack start.
        /// </summary>
        new public void AttackStart()
        {
            DelayAction.Add(
                (int)(UnitDatabase.GetAttackRate(this.Unit) * 1000),
                () =>
            {
                this.currentCount +=
                    (float)((Game.RawGameTime - this.counterStart) / UnitDatabase.GetAttackRate(this.Unit));
            });
            if (!this.counter10Sleeper2.Sleeping)
            {
                this.counter10Started = true;
            }

            if (this.movingWhenReady)
            {
                return;
            }

            if (this.moveSleeper.Sleeping || this.attackSleeper.Sleeping ||
                (this.hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))))
            {
                this.movingWhenReady = true;
            }
        }
Exemple #19
0
        /// <summary>
        ///     The attack start.
        /// </summary>
        public override void AttackStart()
        {
            DelayAction.Add(
                (int)
                ((this.UsingCustomAttackSpeedValue
                      ? UnitDatabase.GetAttackRate(this.Unit, this.CustomAttackSpeedValue)
                      : UnitDatabase.GetAttackRate(this.Unit)) * 1000),
                () =>
            {
                this.currentCount +=
                    (float)
                    ((Game.RawGameTime - this.counterStart)
                     / (this.UsingCustomAttackSpeedValue
                                    ? UnitDatabase.GetAttackRate(this.Unit, this.CustomAttackSpeedValue)
                                    : UnitDatabase.GetAttackRate(this.Unit)));
            });
            if (!this.counter10Sleeper2.Sleeping)
            {
                this.counter10Started = true;
            }

            if (this.movingWhenReady)
            {
                return;
            }

            if (this.moveSleeper.Sleeping || this.attackSleeper.Sleeping ||
                this.hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack")))
            {
                this.movingWhenReady = true;
                Drawing.OnDraw      += this.MoveWhenReady;
            }
        }
        /// <summary>
        ///     The entity_ on int 32 property change.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Entity_OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args)
        {
            if (!sender.Equals(this.Unit) || args.PropertyName != "m_NetworkActivity")
            {
                return;
            }

            if (this.Unit == null || !this.Unit.IsValid)
            {
                Entity.OnInt32PropertyChange -= this.Entity_OnInt32PropertyChange;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var newValue = (NetworkActivity)args.NewValue;
            var oldValue = (NetworkActivity)args.OldValue;

            if (newValue == this.lastUnitActivity || newValue == oldValue)
            {
                return;
            }

            var canCancel    = this.CanCancelAttack();
            var wasAttacking = false;

            if (!this.IsAttackOnCoolDown() || canCancel)
            {
                wasAttacking          = this.isAttacking;
                this.lastUnitActivity = newValue;
                this.isAttacking      = newValue == NetworkActivity.Attack || newValue == NetworkActivity.Crit ||
                                        newValue == NetworkActivity.Attack2 || newValue == NetworkActivity.AttackEvent ||
                                        newValue == NetworkActivity.AttackEventBash ||
                                        newValue == NetworkActivity.EarthshakerTotemAttack;
            }

            if (wasAttacking && canCancel && !this.isAttacking &&
                (oldValue == NetworkActivity.Attack || oldValue == NetworkActivity.Crit ||
                 oldValue == NetworkActivity.Attack2 || oldValue == NetworkActivity.AttackEvent ||
                 oldValue == NetworkActivity.AttackEventBash || oldValue == NetworkActivity.EarthshakerTotemAttack))
            {
                this.AttackEnd();
            }

            if (!this.isAttacking || (!this.isAttacking && !canCancel))
            {
                return;
            }

            this.LastUnitAttackStart = Game.RawGameTime;
            this.NextUnitAttackEnd   =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.NextUnitAttackRelease =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
            this.AttackOrderSent = false;
            this.AttackStart();
        }
        public async Task <IHttpActionResult> GetWeb_Login(string userName, string password, string user, string pass, string param1, string param2)
        {
            if (UnitDatabase.CreateConection(userName, password, "Config", "", ""))
            {
                if (pass == "null")
                {
                    pass = "";
                }
                string sql = string.Format(@" DECLARE  @return_value int
                                              EXEC     @return_value = [dbo].[Web_Login]
                                                       @Code1 = '{0}',
		                                               @UserCode = N'{1}',
                                                       @Code2 = '{2}',
		                                               @Psw = N'{3}'
                                              SELECT   'Return Value' = @return_value",
                                           param1, user, param2, pass);
                int value = UnitDatabase.db.Database.SqlQuery <int>(sql).Single();

                if (value == 1)
                {
                    return(Ok(1));
                }
                else
                {
                    return(Ok(0));
                }
            }
            return(null);
        }
Exemple #22
0
        /// <summary>
        ///     Returns delay before ability is casted
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <param name="usePing"></param>
        /// <param name="useCastPoint"></param>
        /// <param name="abilityName"></param>
        /// <param name="useChannel"></param>
        /// <returns></returns>
        public static double GetCastDelay(
            this Ability ability,
            Hero source,
            Unit target,
            bool usePing       = false,
            bool useCastPoint  = true,
            string abilityName = null,
            bool useChannel    = false)
        {
            var name  = abilityName ?? ability.Name;
            var delay = 0d;

            if (useCastPoint)
            {
                if (!DelayDictionary.TryGetValue(name + " " + ability.Level, out delay))
                {
                    delay = Math.Max(ability.FindCastPoint(name), 0.07);
                    DelayDictionary.Add(name + " " + ability.Level, delay);
                }
                if (name == "templar_assassin_meld")
                {
                    delay += UnitDatabase.GetAttackPoint(source);
                }
                if ((name == "item_diffusal_blade" || name == "item_diffusal_blade_2"))
                {
                    delay += 2;
                }
            }
            else
            {
                if (ability is Item)
                {
                    delay = 0;
                }
                else
                {
                    delay = 0.05;
                }
            }
            if (usePing)
            {
                delay += Game.Ping / 1000;
            }
            if (useChannel)
            {
                delay += ability.ChannelTime(name);
            }
            if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
            {
                return
                    (Math.Max(
                         delay
                         + (!target.Equals(source)
                               ? (useCastPoint ? source.GetTurnTime(target) : source.GetTurnTime(target) / 2)
                               : 0),
                         0));
            }
            return(Math.Max(delay, 0));
        }
Exemple #23
0
        public async Task <IHttpActionResult> DeleteAFI_FDocHi(string ace, string sal, string group, long SerialNumber, string ModeCode)
        {
            if (UnitDatabase.CreateConection(ace, sal, group))
            {
                try
                {
                    string sql = string.Format(@"DECLARE	@return_value int
                                                 EXEC	@return_value = [dbo].[Web_SaveFDoc_Del]
		                                                @SerialNumber = {0}
                                                 SELECT	'Return Value' = @return_value"
                                               , SerialNumber);

                    int value = UnitDatabase.db.Database.SqlQuery <int>(sql).Single();
                    if (value > 0)
                    {
                        await UnitDatabase.db.SaveChangesAsync();
                    }
                }
                catch (Exception e)
                {
                    throw;
                }
            }

            /*
             *          string sql1 = string.Format(@" select top(100)
             *                                              SerialNumber,
             *                                              DocNo,
             *                                              DocDate,
             *                                              CustCode,
             *                                              CustName,
             *                                              Spec,
             *                                              KalaPriceCode,
             *                                              InvCode,
             *                                              AddMinPrice1,
             *                                              AddMinPrice2,
             *                                              AddMinPrice3,
             *                                              AddMinPrice4,
             *                                              AddMinPrice5,
             *                                              AddMinPrice6,
             *                                              AddMinPrice7,
             *                                              AddMinPrice8,
             *                                              AddMinPrice9,
             *                                              AddMinPrice10,
             *                                              ModeCode,
             *                                              Status,
             *                                              PaymentType,
             *                                              Footer,
             *                                              Tanzim,
             *                                              Taeed,
             *                                              FinalPrice,
             *                                              Eghdam
             *                                            from Web_FDocH where ModeCode = {0} ",
             *                                       ModeCode.ToString());
             *          sql1 += " order by DocNo desc ";
             *
             *          var listFDocH = UnitDatabase.db.Database.SqlQuery<Web_FDocHMini>(sql1); */
            return(Ok(1));
        }
Exemple #24
0
    private UnitSpawner()
    {
        _unitViewPrefab = Resources.Load <GameObject>(UnitViewGameObjectPath);

        _unitsAnimationReferences = Resources.Load <UnitsAnimationReferences>(UnitsAnimationReferencesPath);

        _unitDatabase = Resources.Load <UnitDatabase>(UnitConfigurationObjectPath);
    }
 public IQueryable <Web_Status> GetWeb_Status(string userName, string password, string ace, string sal, string group)
 {
     if (UnitDatabase.CreateConection(userName, password, ace, sal, group))
     {
         return(UnitDatabase.db.Web_Status.OrderBy(c => c.OrderFld));
     }
     return(null);
 }
Exemple #26
0
 //コンストラクタ
 public void init()
 {
     //audioSource = new AudioSource();
     //アセットファイルを取得
     growthDatabase    = Resources.Load <GrowthDatabase>("growthDatabase");
     lvUpImpreDatabase = Resources.Load <LvUpImpreDatabase>("lvUpImpreDatabase");
     unitDatabase      = Resources.Load <UnitDatabase>("unitDatabase");
 }
Exemple #27
0
 // GET: HomeApi
 public ActionResult Index()
 {
     if (!UnitDatabase.TestSqlServer(true))
     {
         return(JavaScript(UnitSweet2.ShowMessage(1, "خطا در اتصال", "")));
     }
     return(View());
 }
Exemple #28
0
        public static float GetProjectileSpeed(Hero unit)
        {
            //Console.WriteLine(unit.AttacksPerSecond * Game.FindKeyValues(unit.Name + "/AttackRate", KeyValueSource.Hero).FloatValue / 0.01);
            //var ProjectileSpeed = Game.FindKeyValues(unit.Name + "/ProjectileSpeed", KeyValueSource.Unit).FloatValue;
            var ProjectileSpeed = UnitDatabase.GetByName(unit.Name).ProjectileSpeed;

            return((float)ProjectileSpeed);
        }
 public IQueryable <Web_Kala> GetWeb_Kala(string userName, string password, string ace, string sal, string group)
 {
     if (UnitDatabase.CreateConection(userName, password, ace, sal, group))
     {
         return(UnitDatabase.db.Web_Kala);
     }
     return(null);
 }
Exemple #30
0
 private void Awake()
 {
     tileContoller = FindObjectOfType <TileController>();
     enemySpawner  = FindObjectOfType <EnemySpawner>();
     unitDatabase  = FindObjectOfType <UnitDatabase>();
     tileContoller.Init();
     CreateWaves();
 }
    /*****************************************************/

    void OnEnable()
    {   
        string objectPath = EditorPrefs.GetString("AttackDatabasePath");
        atkDataList = AssetDatabase.LoadAssetAtPath(objectPath, typeof(AttackDataList)) as AttackDataList;
        if(isCardEdit)
            cardDataBase = (CardDatabase)EditorWindow.GetWindow(typeof(CardDatabase));
        else
            unitDataBase = (UnitDatabase)EditorWindow.GetWindow(typeof(UnitDatabase));
    }
    void OnGUI()
    {
        if (atkDataList == null)
        {
            string objectPath = EditorPrefs.GetString("AttackDatabasePath");
            atkDataList = AssetDatabase.LoadAssetAtPath(objectPath, typeof(AttackDataList)) as AttackDataList;
            
        }

        if(isCardEdit && cardDataBase == null)
        {
            cardDataBase = (CardDatabase)EditorWindow.GetWindow(typeof(CardDatabase));
            unitDataBase = null;
        }
        else if(!isCardEdit && unitDataBase == null)
        {
            unitDataBase = (UnitDatabase)EditorWindow.GetWindow(typeof(UnitDatabase));
            cardDataBase = null;
        }

        if(atkDataList.attackList.Count == 0)
            EditorGUILayout.LabelField("Attack List Data Not Available", EditorStyles.boldLabel);
        else
        {
            if (buttonToggled == null || buttonToggled.Count < atkDataList.attackList.Count)
            {
                buttonToggled = new List<bool>();
                toggledIndex = 0;
                for (int i = 0; i < atkDataList.attackList.Count; i++)
                    buttonToggled.Add(false);
            }

            //Filter list or something
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Attack List Data", EditorStyles.boldLabel);

            filterPattern = (AttackPattern)EditorGUILayout.EnumPopup(filterPattern);
            if (GUILayout.Button("Sort", GUILayout.ExpandWidth(false)))
            {
                sortByName();
            }
            GUILayout.EndHorizontal();

            //Show the list
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(GUILayout.Width(180));

            showScrollButtons();

            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            showAttackSummary();

            if(isCardEdit)
            {
                if (GUILayout.Button("Link this attack"))
                {
                    cardDataBase.assignElement(atkDataList.attackList[toggledIndex].uniqueId);
                    cardDataBase.Repaint();
                }
            }
            else
            {
                if (GUILayout.Button("Add this attack"))
                {
                    unitDataBase.AddAttack(unitDataBase.toggledIndex, atkDataList.attackList[toggledIndex].uniqueId);
                    unitDataBase.Repaint();
                }
            }      
            EditorGUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
    }