/// <summary>
 /// 重生
 /// </summary>
 public void OnReborn()
 {
     AddHp(Attrbute.GetValue(AttributeType.MaxHp), false);
     AddMp(Attrbute.GetValue(AttributeType.MaxMp), false);
     m_CharacterController.enabled = true;
     m_AnimController.Play("fuhuo", GotoEmptyFsm, false);
 }
Exemple #2
0
 /// <summary>
 /// 死亡
 /// </summary>
 public virtual void OnDead(DeadCommand ev)
 {
     StopPathFinding();
     this.m_AnimController.Play("die");
     Attrbute.UpdateValue(ActorAttributeType.Hp, 0);
     Attrbute.UpdateValue(ActorAttributeType.Mp, 0);
     this.Clear();
     this.ApplyCharacterCtrl(false);
     this.m_ActorAI.Clear();
     //DBEntiny db = ZTConfig.Instance.GetDBEntiny(Id);
     //if ((this is ActorMainPlayer) == false)
     //{
     //    LevelData.AllActors.Remove(this);
     //}
     //switch (ActorType)
     //{
     //    case EActorType.PLAYER:
     //        if (this is ActorMainPlayer)
     //        {
     //            ZTLevel.Instance.OnMainPlayerDead();
     //        }
     //        break;
     //    case EActorType.MONSTER:
     //        ZTEvent.FireEvent(EventID.RECV_KILL_MONSTER, GUID, Id);
     //        ZTTimer.Instance.Register(1.5f, OnDeadEnd);
     //        break;
     //}
 }
        public override void Init()
        {
            base.Init();
            GameEntry.Event.Subscribe(ChangeEquipEventArgs.EventId, ChangeEquipAvatar);
            GameEntry.Event.Subscribe(SkillKeyDownEventArgs.EventId, TryUseSkill);
            GameEntry.Event.Subscribe(KillMonsterEventArgs.EventId, OnKillMonster);
            GameEntry.Event.Subscribe(ChangeAiModeEventArgs.EventId, OnChangeAiMode);
            GameEntry.Event.Subscribe(ChangeVehicleEventArgs.EventId, OnChangeVehicle);
            GameEntry.Event.Subscribe(ChangePartnerEventArgs.EventId, OnChangePartner);


            m_OriginalParent = CachedTransform.parent;
            m_Vehicle        = this;
            BattleState      = false;

            RefreshBoardEventArgs eventArgs = ReferencePool.Acquire <RefreshBoardEventArgs>();
            int maxHp = Attrbute.GetValue(AttributeType.MaxHp);
            int curHp = Attrbute.GetValue(AttributeType.Hp);

            eventArgs.Fill(EntityId, maxHp, curHp, ActorCard.Level);
            GameEntry.Event.Fire(this, eventArgs);

            BroadcastHeroInfo();
            InitPartner();
            GameEntry.Level.CreatePlayerActor(this);
        }
Exemple #4
0
        public bool IsFullMp()
        {
            int mp    = Attrbute.GetValue(ActorAttributeType.Mp);
            int maxMp = Attrbute.GetValue(ActorAttributeType.MaxMp);

            return(mp >= maxMp);
        }
        private void OnUpgradeLevel()
        {
            this.ActorCard.SetLevel();

            RefreshBoardEventArgs eventArgs = ReferencePool.Acquire <RefreshBoardEventArgs>();
            int maxHp = Attrbute.GetValue(AttributeType.MaxHp);
            int curHp = Attrbute.GetValue(AttributeType.Hp);

            eventArgs.Fill(EntityId, maxHp, curHp, ActorCard.Level);
            GameEntry.Event.Fire(this, eventArgs);

            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillLevel(ActorCard.Level);

            GameEntry.Event.Fire(this, args);

            int        id   = GameEntry.Entity.GenerateTempSerialId();
            EffectData data = new EffectData(id, Constant.Define.LevelUpEffect);

            data.Owner     = this;
            data.KeepTime  = 3;
            data.BindType  = EffectBindType.OwnFoot;
            data.DeadType  = FlyObjDeadType.UntilLifeTimeEnd;
            data.Parent    = CachedTransform;
            data.SetParent = true;
            GameEntry.Entity.ShowEffect(data);
        }
Exemple #6
0
        public bool IsFullHp()
        {
            int hp    = Attrbute.GetValue(ActorAttributeType.Hp);
            int maxHp = Attrbute.GetValue(ActorAttributeType.MaxHp);

            return(hp >= maxHp);
        }
        //Process 1

        #region SaveGstr3B

        #region SaveGSTR3B
        /// <summary>
        /// SaveGSTR1
        /// </summary>
        /// <param name="attrbute"></param>
        /// <returns></returns>
        public GstnResponse SaveGSTR3B(Attrbute attrbute)
        {
            var objBusiness = new UserBusiness();
            var objResponse = new GstnResponse();

            //generate token
            var token = CommonFunction.GetUniqueToken();

            //table storage connection object
            var tblConnection = CommonFunction.GetBlob();

            WEP.GSP.Service.Blob.TableStorage objTableStorage = new TableStorage(Constants.PartitionKey, Constants.RowKey
                                                                                 , token
                                                                                 , Constants.GSTNStageP1Table
                                                                                 , Constants.actualTime);
            //log to table storage  => P1 started
            Task.Factory.StartNew(() =>
                                  objTableStorage.InsertStageToTableStorage(tblConnection.Keys, (int)WEP.GSP.Document.Stage.Validation_BEGIN));

            //paylaod sizecheck
            int payloadSize = GetSizeOfObject(attrbute);

            if (payloadSize >= Constants.PayloadSize)
            {
                throw new Exception("Error : Payload size exceed 5 MB.");
            }

            // SaveGSTR3B
            GSTR3B(attrbute, token, tblConnection, objTableStorage);

            objResponse = GetRespByTokenWithRetrySmallFile(token);

            return(objResponse);
        }
Exemple #8
0
        /// <summary>
        /// ExecuteSaveGSTR3BRequestWithRetry
        /// </summary>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public string ExecuteSaveGSTR3BRequestWithRetry(Attrbute attribute)
        {
            int    remainingTries = Constants.MaxTrial;
            var    exceptions     = new List <Exception>();
            string jsonAttribute  = new JavaScriptSerializer().Serialize(attribute);

            while (remainingTries > 0)
            {
                try
                {
                    return(ExecuteSaveGSTR3BRequest(jsonAttribute));
                }
                catch (TimeoutException e)
                {
                    exceptions.Add(e);
                }
                catch (CustomException cex)
                {
                    exceptions.Add(cex);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                Thread.Sleep(Constants.DelayTrialms);

                remainingTries--;
            }

            throw new AggregateException("Could not process request. Will be re-attempt after some time", exceptions);
        }
        protected override void UpdateHealth()
        {
            int maxHp = Attrbute.GetValue(AttributeType.MaxHp);
            int curHp = Attrbute.GetValue(AttributeType.Hp);
            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillHp(curHp, maxHp);

            GameEntry.Event.Fire(this, args);
        }
Exemple #10
0
        /// <summary>
        /// GetGSTR2CDN
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public string GetGSTR2ACDN(Attrbute objAttr)
        {
            var token = CommonFunction.GetUniqueToken();

            GSTR2ACDN(objAttr, token);

            return(token);
        }
        public Authenticate CommonAuthentication(Attrbute objAttr)
        {
            Authenticate objAuthToken = new Authenticate();

            objAuthToken = new UserValidation(this._clientid,
                                              this._clientSecret
                                              ).CommonAuthentication(objAttr);
            return(objAuthToken);
        }
Exemple #12
0
        //Process 1

        #region Get B2B

        #region GetGSTR2B2B
        /// <summary>
        /// GetGSTR2B2B
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public string GetGSTR2AB2B(Attrbute objAttr)
        {
            //generate token
            var token = CommonFunction.GetUniqueToken();

            GSTR2B2B(objAttr, token);

            return(token);
        }
        protected override void UpdatePower()
        {
            base.UpdatePower();
            int maxMp = Attrbute.GetValue(AttributeType.MaxMp);
            int curMp = Attrbute.GetValue(AttributeType.Mp);
            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillMp(curMp, maxMp);

            GameEntry.Event.Fire(this, args);
        }
Exemple #14
0
        /// <summary>
        /// GSTR2B2B
        /// </summary>
        /// <param name="objAttr"></param>
        private void GSTR2B2B(Attrbute objAttr, string token)
        {
            //table storage connection object
            var tblConnection = CommonFunction.GetBlob();


            //log to table storage  => P1 started
            Task.Factory.StartNew(() =>
                                  new WEP.GSP.Service.Blob.TableStorage(Constants.PartitionKey, Constants.RowKey
                                                                        , (int)WEP.GSP.Document.Stage.Validation_BEGIN
                                                                        , token
                                                                        , Constants.GSTR2AStageTable
                                                                        , Constants.actualTime)
                                  .InsertStageToTableStorage(tblConnection.Keys));
            // prepare message for Event hub
            string jsonReqst = new JavaScriptSerializer()
                               .Serialize(new Request
            {
                RequestType  = RequestType.GSTR2A_GetB2B,
                RequestToken = token,
                Clientid     = _clientid,
                Statecd      = _statecd,
                Username     = _username,
                Txn          = _txn,
                ClientSecret = _clientSecret,
                IpUsr        = _ipUsr,
                AuthToken    = _authToken,
                CreatedOn    = System.DateTime.UtcNow,
                //PartitionKey = Constants.PK_SaveGSTR1,
                RetPeriod        = this._ret_period,
                Gstin            = this._gstin,
                param_ctin       = objAttr.param_ctin,
                param_action     = objAttr.param_action,
                param_gstin      = objAttr.param_gstin,
                param_ret_period = objAttr.param_ret_period,
                Action           = objAttr.action,
                Blob             = tblConnection.Id,
                BlobKey          = tblConnection.Keys,
                ApiAction        = objAttr.apiAction,
                BlobFile         = token
            });

            //Write to Service Bus
            IQueueProcessor masterqueue = new WEP.GSP.EventHub.Queue.ServiceBus();

            masterqueue.WriteAsync(jsonReqst, true);

            //log to table storage  => P1 completed
            Task.Factory.StartNew(() =>
                                  new WEP.GSP.Service.Blob.TableStorage(Constants.PartitionKey, Constants.RowKey
                                                                        , (int)WEP.GSP.Document.Stage.Request_WRT_SUCCESS
                                                                        , token
                                                                        , Constants.GSTR2AStageTable
                                                                        , Constants.actualTime)
                                  .InsertStageToTableStorage(tblConnection.Keys));
        }
        /// <summary>
        /// 强制移动
        /// </summary>
        public virtual void OnForceToMove(MoveCommand ev)
        {
            StopPathFinding();
            Vector3 delta = ev.Delta;
            int     speed = Attrbute.GetValue(AttributeType.Speed);

            CachedTransform.LookAt(new Vector3(CachedTransform.position.x + delta.x, CachedTransform.position.y,
                                               CachedTransform.position.z + delta.y));
            m_CharacterController.SimpleMove(m_CharacterController.transform.forward * speed);
            this.m_AnimController.Play("run", null, true);
        }
        /// <summary>
        /// RequestOTP
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public Authenticate RequestOTP(Attrbute objAttr)
        {
            Authenticate objAuthenticate = new Authenticate();

            objAuthenticate = new UserValidation(this._clientid,
                                                 this._statecd,
                                                 this._txn,
                                                 this._clientSecret,
                                                 this._ipUsr
                                                 ).RequestOTP(objAttr);
            return(objAuthenticate);
        }
        public ServiceResponse <Authenticate> AuthenticateAuthToken(Attrbute objAttr)
        {
            Authenticate objAuthToken = new Authenticate();

            try
            {
                #region Headers
                var req = Request.Headers;

                _clientid = string.IsNullOrEmpty(req.GetValues("clientid").First())
                            ? null :
                            req.GetValues("clientid").First();

                _statecd = string.IsNullOrEmpty(req.GetValues("state-cd").First())
                           ? null :
                           req.GetValues("state-cd").First();


                _txn = string.IsNullOrEmpty(req.GetValues("txn").First())
                       ? null :
                       req.GetValues("txn").First();

                _clientSecret = string.IsNullOrEmpty(req.GetValues("client-secret").First())
                                ? null :
                                req.GetValues("client-secret").First();

                _ipUsr = string.IsNullOrEmpty(req.GetValues("ip-usr").First())
                         ? null :
                         req.GetValues("ip-usr").First();

                #endregion

                objAuthToken = new UserBusiness(this._clientid,
                                                this._statecd,
                                                this._txn,
                                                this._clientSecret,
                                                this._ipUsr
                                                ).AuthenticateAuthToken(objAttr);


                var respone = new ServiceResponse <Authenticate> {
                    ResponseObject = objAuthToken, IsError = false
                };
                return(respone);
            }
            catch (Exception ex)
            {
                var resErr = new ServiceResponse <string> {
                    ResponseObject = ex.Message, IsError = true
                };
                return(resErr);
            }
        }
        /// <summary>
        /// AuthenticateAuthToken
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public Authenticate AuthenticateAuthToken(Attrbute objAttr)
        {
            Authenticate objAuthToken = new Authenticate();

            objAuthToken = new UserValidation(this._clientid,
                                              this._statecd,
                                              this._txn,
                                              this._clientSecret,
                                              this._ipUsr
                                              ).AuthenticateAuthToken(objAttr);
            return(objAuthToken);
        }
Exemple #19
0
        public bool UseMp(int use)
        {
            int mp = Attrbute.GetValue(ActorAttributeType.Mp);

            if (mp > use)
            {
                Attrbute.UpdateValue(ActorAttributeType.Mp, mp - use);
                UpdatePower();
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// GetGSTR3BTrackStatusWithResponse
        /// </summary>
        /// <param name="objAttribute"></param>
        /// <returns></returns>
        public GstnResponse GetGSTR3BTrackStatusWithResponse(Attrbute objAttribute)
        {
            UserBusiness objBusiness = new UserBusiness();
            GstnResponse objResponse = new GstnResponse();

            var token = CommonFunction.GetUniqueToken();

            GSTR3BTrackStatus(objAttribute, token);

            objResponse = GetRespByTokenWithRetrySmallFile(token);

            return(objResponse);
        }
        /// <summary>
        /// GetGSTR3BSummary
        /// </summary>
        /// <param name="objAttribute"></param>
        /// <returns></returns>
        public GstnResponse GetGSTR3BSummary(Attrbute objAttribute)
        {
            var objBusiness = new UserBusiness();
            var objResponse = new GstnResponse();

            var token = CommonFunction.GetUniqueToken();

            GSTR3BSummary(objAttribute, token);

            objResponse = GetRespByTokenWithRetry(token);

            return(objResponse);
        }
Exemple #22
0
        /// <summary>
        /// GetGSTR2AFileDetailsWithResponse
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public GstnResponse GetGSTR2AFileDetailsWithResponse(Attrbute objAttr)
        {
            UserBusiness objBusiness = new UserBusiness();
            GstnResponse objResponse = new GstnResponse();

            var token = CommonFunction.GetUniqueToken();

            GSTR2AFileDetails(objAttr, token);

            objResponse = GetRespByTokenWithRetry(token);

            return(objResponse);
        }
Exemple #23
0
        public bool UseHp(int use)
        {
            int hp = Attrbute.GetValue(ActorAttributeType.Hp);

            if (hp > use)
            {
                Attrbute.UpdateValue(ActorAttributeType.Hp, hp - use);
                UpdatePower();
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// 死亡
        /// </summary>
        public virtual void OnDead(DeadCommand ev)
        {
            StopPathFinding();
            this.m_AnimController.Play("die");
            Attrbute.UpdateValue(AttributeType.Hp, 0);
            Attrbute.UpdateValue(AttributeType.Mp, 0);
            this.ApplyCharacterCtrl(false);

            //播放死亡动画后删除
            GameEntry.Timer.Register(3f, () =>
            {
                GameEntry.Level.DelRole(this.Camp, this.EntityId);
            });
        }
        public GstnResponse SearchTaxpayer(string gstin, string action)
        {
            try
            {
                GstnResponse objResponse = new GstnResponse();

                Authenticate objAuthToken = new Authenticate();
                Attrbute     objAttr      = new Attrbute();

                EncryptionUtils objEncrypt = new Business.EncryptionUtils();

                byte[] arrKey = objEncrypt.CreateKey();

                string app_key = objEncrypt.EncryptTextWithPublicKey(arrKey);

                string encPassword = objEncrypt.EncryptTextWithPublicKey(Constants.PublicAuthPassword);

                objAttr.username = Constants.PublicAuthUsername;
                objAttr.password = encPassword;
                objAttr.app_key  = app_key;
                objAttr.action   = Constants.PublicAuthAction;
                string clientid     = Constants.PublicClientId;
                string clientsecret = Constants.PublicClientSecret;

                objAuthToken = new UserValidation(clientid,
                                                  clientsecret
                                                  ).CommonAuthentication(objAttr);

                if (objAuthToken.status_cd == "1")
                {
                    objResponse = new UserValidation(clientid,
                                                     clientsecret,
                                                     objAuthToken.auth_token,
                                                     objAttr.username
                                                     ).SearchTaxpayer(gstin, action);
                    return(objResponse);
                }
                else
                {
                    objResponse.error = objAuthToken.error;
                    return(objResponse);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(null);
        }
Exemple #26
0
        public GstnResponse DownloadGstn()
        {
            string token = "a3850a97-3011-425a-8227-ff7d222c8f88_636376236940662300";

            GstnResponse objGstnResponse = new GstnResponse();
            UserBusiness objBusiness     = new UserBusiness();
            Attrbute     objAttrbute     = new Attrbute();
            Blob         objBlob         = new Blob();

            objGstnResponse = objBusiness.GetBlobConnectionByToken(token);



            return(objGstnResponse);
        }
Exemple #27
0
        public virtual void TakeDamage(IActor attacker, int damage, bool strike)
        {
            ShowFlyword(strike ? FlyWordType.CritHurt : FlyWordType.Hurt, damage);

            int curHp = Attrbute.GetValue(ActorAttributeType.Hp);

            if (curHp > damage)
            {
                Attrbute.UpdateValue(ActorAttributeType.Hp, curHp - damage);
            }
            else
            {
                Attrbute.UpdateValue(ActorAttributeType.Hp, 0);
            }
            UpdateHealth();
            if (curHp <= 0)
            {
                ExecuteCommand(new DeadCommand(ActorDeadType.Normal));
            }
        }
        /// <summary>
        /// GSTR3B
        /// </summary>
        /// <param name="attrbute"></param>
        /// <param name="token"></param>
        private void GSTR3B(Attrbute attrbute, string token, Blob blob, TableStorage objTableStorage)
        {
            //upload  payload to blob storage
            var blobStorage = new BlobStorage(blob.Connection, Constants.CotainerPayload, token, new Dictionary <string, string>(), blob.Id);

            var blobPath = blobStorage.UploadBlob(attrbute);

            // prepare message for Event hub
            string jsonReqst = new JavaScriptSerializer()
                               .Serialize(new Request
            {
                RequestType  = RequestType.SaveGSTR3B,
                BlobFile     = token,
                RequestToken = token,
                Blob         = blob.Id,
                Clientid     = _clientid,
                Statecd      = _statecd,
                Username     = _username,
                Txn          = _txn,
                ClientSecret = _clientSecret,
                IpUsr        = _ipUsr,
                AuthToken    = _authToken,
                CreatedOn    = System.DateTime.UtcNow,
                //PartitionKey = Constants.PK_SaveGSTR1,
                RetPeriod = this._ret_period,
                Gstin     = this._gstin,
                ApiAction = attrbute.apiAction
            });

            //Write to Service Bus

            IQueueProcessor masterqueue = new WEP.GSP.EventHub.Queue.ServiceBus();

            masterqueue.WriteAsync(jsonReqst, true);

            //log to table storage  => P1 completed
            Task.Factory.StartNew(() =>
                                  objTableStorage.InsertStageToTableStorage(blob.Keys, (int)WEP.GSP.Document.Stage.Request_WRT_SUCCESS));
        }
Exemple #29
0
        public void AddMp(int mp, bool showFlyword)
        {
            if (IsDead)
            {
                return;
            }
            int newMp = Attrbute.GetValue(ActorAttributeType.Mp);

            if (newMp + mp > Attrbute.GetValue(ActorAttributeType.MaxMp))
            {
                newMp = Attrbute.GetValue(ActorAttributeType.MaxMp);
            }
            else
            {
                newMp += mp;
            }
            Attrbute.UpdateValue(ActorAttributeType.Mp, newMp);
            if (showFlyword)
            {
                ShowFlyword(FlyWordType.MpHeal, mp);
            }
            this.UpdatePower();
        }
        public ServiceResponse <string> SendGSTNRequest(Attrbute objAttr)
        {
            string eventhubReqRead = "{\"PartitionKey\":\"PK_SaveGSTR1\",\"RequestType\":1,\"Clientid\":\"l7xxdf2b47b7d728426699a05c8d1ec33a60\",\"Statecd\":\"11\",\"Username\":\"WeP\",\"Txn\":\"returns\",\"ClientSecret\":\"30a28162eb024f6e859a12bbb9c31725\",\"IpUsr\":\"12.8.9l.80\",\"Blob\":2,\"BlobFile\":\"l7xxf1dd5228b4bc4ec28201638d1717a4ae_27_12.8.9l.80_636329771857468386\",\"RequestToken\":\"l7xxdf2b47b7d728426699a05c8d1ec33a60_WeP_11_12.8.9l.80_636305444387777979\",\"AuthToken\":\"8a227e0ba56042a0acdf98b3477d2c03\",\"CreatedOn\":\"5/1/2017 11:47:52 AM\",\"Response\":null,\"ModifiedOn\":null}";

            objAttr.reqJsonData = eventhubReqRead;

            try
            {
                GSTR1Business objBusiness = new GSTR1Business();

                ServiceResponse <string> response = objBusiness.SendGSTNRequest(objAttr.reqJsonData);

                return(response);
            }
            catch (Exception ex)
            {
                var resErr = new ServiceResponse <string> {
                    ResponseObject = ex.Message, IsError = true
                };
                return(resErr);
            }
            return(null);
        }