示例#1
0
        public override void Init(params object[] args)
        {
            var data = PlayerManager.Instance.playerData;

            nameTxt.text = string.IsNullOrEmpty(data.playerName) ? ConstTextManager.Get(TextId.Player_Name_Default) : data.playerName;
            UpdateProperty(data.property);
        }
示例#2
0
        private void UpdateCraftBtn()
        {
            var recipeUnlock = this.currSelectRecipe.unlock;

            this.btnCraftText.text = recipeUnlock ? ConstTextManager.Get(TextId.Craft_Btn_Craft) : ConstTextManager.Get(TextId.Craft_Btn_Unlock);
            var state = this.currSelectRecipe.canCraft;

            this.btnCraft.enabled   = state;
            this.btnCraftText.color = state ? Color.black : Color.gray;
        }
示例#3
0
 public void OnClickCraft()
 {
     if (this.isCrafting)
     {
         CancelCraft();
         UpdateCraftBtn();
         return;
     }
     if (this.Busy)
     {
         return;
     }
     if (this.currSelectRecipe == null)
     {
         return;
     }
     this.Busy      = true;
     this.craftTime = 0;
     this.btnCraftEffect.gameObject.SetActive(true);
     this.btnCraftText.text = ConstTextManager.Get(TextId.Cancel);
     Utils.SetWidth(this.btnCraftEffectTrans, 0);
     this.isCrafting  = true;
     this.currTweener = DOTween.To(() => this.craftTime, x => this.craftTime = x, 5, 5).SetEase(Ease.Linear).OnUpdate(
         () =>
     {
         Utils.SetWidth(this.btnCraftEffectTrans, this.btnDefaultWidth * this.craftTime / 5f);
     }).OnComplete(
         () =>
     {
         Debug.Log("......");
         var t = 0f;
         this.btnCraftEffectTrans.pivot = new Vector2(0.5f, 0.5f);
         this.currTweener = DOTween.To((x) => t = x, 1, 0, 0.1f).OnUpdate(() =>
         {
             this.btnCraftEffect.alpha = t;
             this.btnCraftEffect.transform.localScale = (5 - 4 * t) * Vector3.one;
         }).OnComplete(() =>
         {
             Debug.Log(".......2");
             this.btnCraftEffectTrans.pivot = new Vector2(0f, 0.5f);
             var param = new Hashtable()
             {
                 { "id", this.currSelectRecipe.masterData.id }
             };
             GameManager.Instance.SendCommand(CommandType.Craft, param, OnCraftComplete);
             this.currTweener = null;
         });
     });
 }
        public override IEnumerator DoCommand(object param)
        {
            var pp = param as Param;

            if (pp == null)
            {
                Debug.LogError("collect param error");
                yield break;
            }
            var items = GameManager.Instance.playerManager.Reward(pp.collect.dropItemData);
            //yield return FieldMap.Instance.CollectResource(obj);
            var msg = ConstTextManager.Get(TextId.Msg_GetItem, Utils.GetItemString(items));

            Utils.GlobalMessage(msg);
            if (pp.collect.destroy)
            {
                FieldMap.Instance.RemoveObject(pp.obj);
            }
            yield return(0);
        }