예제 #1
0
    void SetPropertyPos()
    {
        float actionTime = 0.5f;

        for (int i = 0; i < PropertyBox.Count; i++)
        {
            PropertyElementBase _p = (PropertyElementBase)PropertyBox[i];

            Vector3 pos = GetPropertyPos(_p.ID);

            if (i < PropertyBox.Count - 1)
            {
                LeanTween.moveLocal(_p.Button.gameObject, pos, actionTime);
            }
            else
            {
                LeanTween.moveLocal(_p.Button.gameObject, pos, actionTime).setEase(LeanTweenType.easeInOutQuad).setOnComplete(
                    () =>
                {
                    //改变状态
                    ChangeRecipeStat(RecipeStat.WaitInput);
                });
            }
        }
    }
예제 #2
0
    CharBag.Goods CreateGoods()
    {
        CharBag.Goods goods = new CharBag.Goods();
        goods.Property = new int[4];

        for (int i = 0; i < PropertyBox.Count; i++)
        {
            //如果大于最大个数则忽略
            if (i >= 4)
            {
                break;
            }
            PropertyElementBase p = (PropertyElementBase)PropertyBox[i];
            goods.Property[i] = p.Property.ID;
        }

        goods.Quality = Quality;
        goods.Number  = 1;
        goods.Name    = recipe.Name;

        string target = recipe.Target;

        if (target[0] == char.Parse("0"))
        {
            string mat_str = target.Substring(target.IndexOf(",") + 1);
            goods.MateriralType = 0;
            goods.ID            = int.Parse(mat_str);
        }
        else if (target[0] == char.Parse("1"))
        {
            string mat_str = target.Substring(target.IndexOf(",") + 1);
            goods.MateriralType = 1;
            goods.ID            = int.Parse(mat_str);
        }

        goods.Type          = Materiral.GetTypeByMaterialID(goods.MateriralType, goods.ID);
        goods.MaterialEffet = QualityEffectID;

        //计算价格
        goods.Price = Materiral.GetMaterialPrice(goods.MateriralType, goods.ID);
        goods       = CharBag.SetPrice(goods);

        //添加道具
        goods.UID = CharBag.AddGoods(goods);

        questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.ComposeGoods, goods, 0);
        //更新物品信息
        PlayerInfo.AddGoodsInfo(goods.MateriralType, goods.ID, PlayerInfo.GoodsInfoType.RecipeCount);

        //删除道具
        foreach (SlotBox slot in SlotList.Values)
        {
            CharBag.RemoveGoods(slot.slot.UID);
        }

        return(goods);
    }
예제 #3
0
    //属性效果UI效果
    void AddPropertyUIEft(CharBag.Goods _slot)
    {
        float actionTime = 0.5f;

        for (int i = 0; i < _slot.Property.Length; i++)
        {
            if (_slot.Property[i] == 0)
            {
                continue;
            }

            int           proID     = _slot.Property[i];
            RectTransform _property = Instantiate(PropertyListElement).GetComponent <RectTransform>();
            _property.transform.SetParent(PropertyListGrid.transform, false);

            _property.localPosition = GetPropertyPos(PropertyBox.Count + 1);
            _property.sizeDelta     = GetPropertySize(PropertyBox.Count + 1);

            //获取materiral的颜色
            Color _color_image = _property.GetComponent <Image>().color;
            Color _color_text  = _property.transform.Find("Text").GetComponent <Text>().color;
            Color from         = new Color(_color_image.r, _color_image.g, _color_image.b, 0);
            _property.GetComponent <Image>().color = from;
            _property.transform.Find("Image").GetComponent <Image>().color = from;
            _property.transform.Find("Text").GetComponent <Text>().color   = from;

            //渐现效果
            LeanTween.value(_property.gameObject, from, _color_image, 0.25f).setDelay(actionTime).setOnUpdate(
                (Color col) =>
            {
                _property.GetComponent <Image>().color = col;
            }
                );
            LeanTween.value(_property.gameObject, from, _color_text, 0.25f).setDelay(actionTime).setOnUpdate(
                (Color col) =>
            {
                _property.transform.Find("Text").GetComponent <Text>().color = col;
            }
                );
            LeanTween.value(_property.gameObject, from, new Color(1, 1, 1, 1), 0.25f).setDelay(actionTime).setOnUpdate(
                (Color col) =>
            {
                _property.transform.Find("Image").GetComponent <Image>().color = col;
            }
                );

            //TODO:点击效果

            //EndTODO

            Materiral.Property _p = Materiral.GetProNameByProID(proID);
            _property.transform.Find("Text").GetComponent <Text>().text     = _p.Name;
            _property.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetIconByName(_p.IMG);

            PropertyElementBase _proBase = new PropertyElementBase();
            _proBase.ID       = PropertyBox.Count + 1;
            _proBase.Property = _p;
            _proBase.Button   = _property;
            PropertyBox.Add(_proBase);
        }
    }