void AddGoodsToHead()
    {
        GameObject     goods   = new GameObject();
        SpriteRenderer _sprite = goods.AddComponent <SpriteRenderer>();

        ShopUI _shop = transform.Find("/goodBox").GetComponent <ShopUI>();

        CharBag.Goods[] goodslist = _shop.GetGoods();

        //如果货架上有商品,则添加道具到背包
        if (goodslist[selectgoods.slotID - 1].Name != null && goodslist[selectgoods.slotID - 1].ID != 0)
        {
            //移除道具
            _shop.BuyedGoods(selectgoods);
        }

        _sprite.sprite           = Materiral.GetMaterialIcon(selectgoods.goods.MateriralType, selectgoods.goods.ID);
        _sprite.sortingLayerName = "Character";

        //设定道具的为角色的子物件
        goods.transform.SetParent(this.transform, false);
        goods.transform.position = goodsVertor;

        //把物体移动到头上
        LeanTween.move(goods.gameObject, new Vector2(goodsVertor.x, goodsVertor.y + 0.5f), 0.5f);
    }
示例#2
0
 void AddFristPropertyUIEft()
 {
     CharBag.Goods _fristGoods = new CharBag.Goods();
     string[]      mt          = recipe.Target.Split(',');
     _fristGoods.Property = Materiral.GetMaterialProperty(int.Parse(mt[0]), int.Parse(mt[1]));
     AddPropertyUIEft(_fristGoods);
 }
    void FlyCoin()
    {
        GameObject     obj = new GameObject();
        SpriteRenderer sr  = obj.AddComponent <SpriteRenderer>();

        sr.sprite           = Materiral.GetIconByName("actionIcon_6");
        sr.sortingLayerName = "Character";

        Vector3 startpos     = transform.position;
        float   randomlength = Random.Range(-0.4f, 0.4f);
        Vector3 endpos       = new Vector3(startpos.x + randomlength, Random.Range(-4.3f, -4.47f), 0);

        float randomheight = Random.Range(0.3f, 0.6f);
        float time         = Mathf.Abs(randomheight);

        Debug.Log(randomheight);
        Vector3[] _path = new Vector3[] { startpos, startpos, new Vector3(startpos.x + randomlength / 2, randomheight + startpos.y, startpos.z), endpos, endpos };
        LeanTween.moveSpline(obj, _path, time).setOnComplete(() =>
        {
            LeanTween.moveY(obj, randomheight / 5 + startpos.y, time / 5).setOnComplete(() =>
            {
                LeanTween.moveY(obj, endpos.y, time / 5).setEase(LeanTweenType.easeOutBounce);
            });
        });

        TimeTool.SetWaitTime(5f, obj, () =>
        {
            LeanTween.alpha(obj, 0, 1).setDestroyOnComplete(true);
        });
    }
示例#4
0
    //合成属性的方法
    public ArrayList ComposeProperty(ArrayList PropertyBox, out Result Compose)
    {
        //ArrayList SortPropertyBox = SelectionSortAscendingByProperty(PropertyBox);
        ArrayList AllComposeResult = FindAllComposeResult(PropertyBox);

        Compose = new Result();
        bool canCompose = false;

        foreach (Result r in AllComposeResult)
        {
            //如何有可以合成的属性则跳出循环
            if (canCompose)
            {
                break;
            }

            foreach (PropertyRecipe pr in PropertyRecipeList)
            {
                int _sum = pr.Slots[0] + pr.Slots[1];
                if (_sum == r.sum)
                {
                    if (pr.Slots[0] == r.Base1.Property.ID && pr.Slots[1] == r.Base2.Property.ID)
                    {
                        //表示可以合成
                        canCompose    = true;
                        Compose.sum   = pr.Target;
                        Compose.Base1 = r.Base1;
                        Compose.Base2 = r.Base2;
                        break;
                    }
                    if (pr.Slots[1] == r.Base1.Property.ID && pr.Slots[0] == r.Base2.Property.ID)
                    {
                        //表示可以合成
                        canCompose    = true;
                        Compose.sum   = pr.Target;
                        Compose.Base1 = r.Base1;
                        Compose.Base2 = r.Base2;
                        break;
                    }
                }
            }
        }

        if (canCompose)
        {
            Compose.Base1.Property            = Materiral.GetProNameByProID(Compose.sum);
            PropertyBox[Compose.Base1.ID - 1] = Compose.Base1;
            PropertyBox.Remove(Compose.Base2);

            for (int i = 0; i < PropertyBox.Count; i++)
            {
                RecipeUI.PropertyElementBase _p = (RecipeUI.PropertyElementBase)PropertyBox[i];
                _p.ID          = i + 1;
                PropertyBox[i] = _p;
            }
        }
        return(PropertyBox);
    }
示例#5
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);
    }
示例#6
0
    void ComposeProperty()
    {
        int   listCount  = PropertyBox.Count;
        float actionTime = 0.5f;
        float DelayTime  = 1f;

        Recipe.Result composID = new Recipe.Result();
        ArrayList     compose  = recipeMap.ComposeProperty(PropertyBox, out composID);

        if (compose.Count != listCount)
        {
            if (_composCount > 0)
            {
                DelayTime = 0;
            }

            _composCount++;
            LeanTween.move(composID.Base2.Button.gameObject, composID.Base1.Button.position, actionTime).setEase(LeanTweenType.easeInOutQuad).setDelay(DelayTime).setOnComplete(
                () =>
            {
                composID.Base1.Button.Find("Text").GetComponent <Text>().text     = composID.Base1.Property.Name;
                composID.Base1.Button.Find("Image").GetComponent <Image>().sprite = Materiral.GetIconByName(composID.Base1.Property.IMG);
                Destroy(composID.Base2.Button.gameObject);
                //更新任务
                //questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.ComposeProperty, composID.Base1.ID);
                LeanTween.scale(composID.Base1.Button.gameObject, new Vector3(1.1f, 1.1f, 1.1f), 0.125f).setLoopPingPong(1).setOnComplete(
                    () =>
                {
                    ComposeProperty();
                });
            });
        }
        else
        {
            //如果合成,则等待oncomplete改变状态
            if (_composCount > 0)
            {
                //改变状态
                _composCount = 0;
                ShowComposeButton();
                //对齐位置
                SetPropertyPos();
                return;
            }
            //如果合成没有合成时
            else
            {
                _composCount = 0;
                ShowComposeButton();
                //改变状态
                ChangeRecipeStat(RecipeStat.WaitInput);
                return;
            }
        }
    }
示例#7
0
    public void SetGoodsName(int MaterialType)
    {
        //创建物品列表
        for (int i = 0; i < _bagList.Count; i++)
        {
            CharBag.Goods _map = (CharBag.Goods)_bagList[i];

            //筛选物品,特殊物品不显示
            if (MaterialType != -1)
            {
                if (_map.MateriralType != MaterialType)
                {
                    continue;
                }
                if (_map.MateriralType == 2 && _map.Type == 0)
                {
                    continue;
                }
            }

            GameObject button = Instantiate(btn_menu);
            button.transform.SetParent(_fitter.transform, false);

            button.name = _map.ID.ToString();
            button.transform.Find("Text").GetComponent <Text>().text     = _map.Name;
            button.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(_map.MateriralType, _map.ID);

            //显示数量
            button.transform.Find("num").gameObject.SetActive(true);
            button.transform.Find("num/Text").GetComponent <Text>().text = _map.Number.ToString();

            //显示价格
            button.transform.Find("PriceBoard").gameObject.SetActive(true);
            button.transform.Find("PriceBoard/Text").GetComponent <Text>().text = _map.Price.ToString();

            //设置参数容器中的参数
            Parameter.Box _p = new Parameter.Box();
            _p.obj = _map;

            //设置点击事件
            OnClickInScorll.Get(button.transform).parameter         = _p;
            OnClickInScorll.Get(button.transform).onHoldByParameter = ShowMateriralInfo;

            //添加背包进入筛选背包列表
            f_BagList.Add(_map);
        }

        //调整列表为置顶
        if (f_BagList.Count > 5)
        {
            setGird();
        }

        StartCoroutine(SetListToTop());
    }
示例#8
0
    static public string SpecialString(string str)
    {
        string pattern = @"\[(.*?)\]";

        foreach (Match match in Regex.Matches(str, pattern))
        {
            string spstr = "";
            int    index = match.Value.IndexOf(" ");
            if (index > 0)
            {
                spstr = match.Value.Substring(1, index - 1);
            }
            else
            {
                spstr = match.Value.Substring(1, match.Value.Length - 2);
            }

            Debug.Log(spstr);

            string parstr = "";
            switch (spstr)
            {
            case "localtime":
                str = str.Replace(match.Value, System.DateTime.Now.ToString("HH:mm"));
                break;

            case "gametime":
                break;

            case "item":
                index  = match.Value.LastIndexOf(" ");
                parstr = match.Value.Substring(index, match.Value.Length - index - 1);
                //查找材料名称
                string[] str_temp = parstr.Split(':');
                string   itemname = "<color=red>" + Materiral.GetMaterialName(int.Parse(str_temp[0]), int.Parse(str_temp[1])) + "</color>";
                str = str.Replace(match.Value, itemname);
                break;

            case "point":
                index  = match.Value.LastIndexOf(" ");
                parstr = match.Value.Substring(index, match.Value.Length - index - 1);
                //查找路点名称
                string pathname = "<color=blue>" + MapPathManager.GetPathName(int.Parse(parstr)) + "</color>";;
                str = str.Replace(match.Value, pathname);
                break;

            default:
                break;
            }
        }
        return(str);
    }
示例#9
0
    void SetRecipeName()
    {
        for (int i = 0; i < recipeMap.ReicipeList.Count; i++)
        {
            GameObject button = Instantiate(recipeButton);
            button.transform.SetParent(_fitter.transform, false);

            Recipe.RecipeMap _map = (Recipe.RecipeMap)recipeMap.ReicipeList[i];

            button.name = _map.ID.ToString();
            button.transform.Find("Text").GetComponent <Text>().text = _map.Name;
            int _t = _map.Target[0].ToString() == "0" ? 0 : 1;
            int _i = int.Parse(_map.Target.Substring(_map.Target.IndexOf(",") + 1));

            button.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(_t, _i);

            //设置点击事件
            //button.GetComponent<Button>().onClick.AddListener(OpenRecipe);
            OnClickInScorll.Get(button.transform).onClick = OpenRecipe;
        }
    }
示例#10
0
    void ShowMaterialIcon(CharBag.Goods goods, RectTransform rect)
    {
        //显示采集到的素材图标
        GameObject materiralicon = new GameObject();
        Image      sr            = materiralicon.AddComponent <Image>();

        sr.sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);
        materiralicon.transform.position = rect.position;
        materiralicon.transform.SetParent(MateriralList.Find("ListBox"), false);
        materiralicon.transform.localScale = new Vector3(1, 1, 1);
        materiralicon.GetComponent <RectTransform>().sizeDelta = new Vector2(50, 50);

        //由路点落到list处
        RectTransform er = MateriralList.Find("ListBox").GetComponent <RectTransform>();

        LeanTween.moveLocal(materiralicon, new Vector3(er.localPosition.x, er.rect.height, 0), 1f);
        LeanTween.scale(materiralicon, new Vector3(0, 0, 0), 0.4f).setEase(LeanTweenType.easeInBack).setDestroyOnComplete(true).setOnComplete(() =>
        {
            StartCoroutine(ShowMateriralInList(goods));
        });
    }
示例#11
0
    //上架商品
    void ClickInBag(GameObject go, object parameter)
    {
        Parameter.Box p     = (Parameter.Box)parameter;
        CharBag.Goods goods = (CharBag.Goods)p.obj;

        //如果货架上有商品,则添加道具到背包
        if (goodslist[p.ID - 1].Name != null && goodslist[p.ID - 1].ID != 0)
        {
            CharBag.AddGoods(goodslist[p.ID - 1]);
        }

        //添加选中的商品到商品列
        goodslist[p.ID - 1] = goods;
        string path = p.ID.ToString() + "/itemIcon";

        transform.Find(path).GetComponent <SpriteRenderer>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);

        //显示商品价格
        string priceiconpath = p.ID.ToString() + "/price/icon";
        string pricepath     = p.ID.ToString() + "/price/text";

        transform.Find(priceiconpath).gameObject.SetActive(true);
        transform.Find(pricepath).gameObject.SetActive(true);
        transform.Find(pricepath).GetComponent <TextMesh>().text = goods.Price.ToString();


        //移除背包中的商品
        CharBag.RemoveGoods(goods.UID);

        _bagInstance.CloseBagMenu(gameObject);
        ChangeRecipeUiState();

        PlayerData.ShopGoodsData.SaveShopGoods(goodslist);
        CharBag.SaveBagGoods();

        questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.PutGoods, goods, 0);

        //更新物品信息
        PlayerInfo.AddGoodsInfo(goods.MateriralType, goods.ID, PlayerInfo.GoodsInfoType.PutCount);
    }
示例#12
0
    static public int AddGoodsByID(int materialType, int ID)
    {
        Goods newgoods = new Goods();

        newgoods.ID       = ID;
        newgoods.Number   = 1;
        newgoods.Property = Materiral.GetMaterialProperty(materialType, ID);
        newgoods.Quality  = 80;

        if (materialType == 0)
        {
            Materiral.Items _item = Materiral.FindItemByID(ID);
            newgoods.Name  = _item.Name;
            newgoods.Price = _item.Price;
            newgoods.Type  = _item.Type;
        }   //item
        else if (materialType == 1)
        {
            Materiral.Minds _mind = Materiral.FindMindByID(ID);
            newgoods.Name          = _mind.Name;
            newgoods.Price         = _mind.Price;
            newgoods.Type          = _mind.Type;
            newgoods.MateriralType = 1;
        }   //mind
        else if (materialType == 2)
        {
            Materiral.SpecialItem _sepcial = Materiral.FindSpecialItemByID(ID);
            newgoods.Name          = _sepcial.Name;
            newgoods.Price         = _sepcial.Price;
            newgoods.Type          = _sepcial.Type;
            newgoods.MateriralType = 2;
        }   //specail

        //添加物品
        int uid = AddGoods(newgoods);

        return(uid);
    }
示例#13
0
    public void AddQustUI(QuestManager.QuestBase quest)
    {
        GameObject questButton = Instantiate(QuestButton);

        questButton.name = quest.ID.ToString();
        questButton.transform.SetParent(QuestListUI.transform, false);

        Image     iconImage   = questButton.transform.Find("icon").GetComponent <Image>();
        Slider    prograssBar = questButton.transform.Find("progress").GetComponent <Slider>();
        Transform hint        = questButton.transform.Find("hint");

        iconImage.sprite  = Materiral.GetIconByName(quest.Smallicon);
        prograssBar.value = (float)PlayerInfo.GetQuestProgress(quest.ID) / quest.QuestComplete.Num;
        //如果已经完成
        if (prograssBar.value >= 1)
        {
            hint.gameObject.SetActive(true);
            AniController.Get(hint.gameObject).AddSprite(hintsprites);
            hint.GetComponent <Image>().color = Color.green;
            AniController.Get(hint.gameObject).PlayAni(0, 3, AniController.AniType.Loop, 5);
        }
        EventTriggerListener.Get(questButton).onClick = OpenQuestBoard;
    }
示例#14
0
    public void creatIcon()
    {
        int count = Random.Range(19, 20);

        for (int i = 1; i <= count; i++)
        {
            GameObject     obj = new GameObject();
            SpriteRenderer sr  = obj.AddComponent <SpriteRenderer>();
            sr.sprite = Materiral.GetIconByName("actionIcon_6");

            Vector3 endpos = new Vector3(startpos.x + Random.Range(-0.5f, 0.5f), startpos.y + Random.Range(-0.05f, 0.05f), 0);

            float randomheight = Random.Range(0.3f, 0.6f);
            float time         = Mathf.Abs(randomheight);
            Debug.Log(randomheight);
            Vector3[] _path = new Vector3[] { startpos, startpos, new Vector3(endpos.x / 2, randomheight + startpos.y, startpos.z), endpos, endpos };
            LeanTween.moveSpline(obj, _path, time).setOnComplete(() => {
                LeanTween.moveY(obj, randomheight / 5 + startpos.y, time / 5).setOnComplete(() => {
                    LeanTween.moveY(obj, endpos.y, time / 5).setEase(LeanTweenType.easeOutBounce);
                });
            });
        }
    }
示例#15
0
    //进入商店场景时显示上架的商品
    void InitShopGoods()
    {
#if _Debug
        Debug.Log("配置商店物品..");
#endif

        for (int i = 0; i < goodslist.Length; i++)
        {
            string priceiconpath = (i + 1).ToString() + "/price/icon";
            string pricepath     = (i + 1).ToString() + "/price/text";
            transform.Find(priceiconpath).gameObject.SetActive(false);
            transform.Find(pricepath).gameObject.SetActive(false);

            if (goodslist[i].Name != null && goodslist[i].ID != 0)
            {
                transform.Find(priceiconpath).gameObject.SetActive(true);
                transform.Find(pricepath).gameObject.SetActive(true);

                string path = (i + 1).ToString() + "/itemIcon";
                transform.Find(path).GetComponent <SpriteRenderer>().sprite = Materiral.GetMaterialIcon(goodslist[i].MateriralType, goodslist[i].ID);
            }
        }
    }
示例#16
0
    public void OpenItemInfo(CharBag.Goods good)
    {
        //名称
        goodsUIBase.nameText.text = good.Name;

        //图片icon
        goodsUIBase.goodsIMG.sprite = Materiral.GetMaterialIcon(good.MateriralType, good.ID);

        //物品类型
        if (good.MateriralType == 0)
        {
            goodsUIBase.MaterialtypeText.text = "类型:物品";
        }
        else if (good.MateriralType == 1)
        {
            goodsUIBase.MaterialtypeText.text = "类型:概念";
        }
        else
        {
            goodsUIBase.MaterialtypeText.text = "类型:未知";
        }

        //数量
        goodsUIBase.numText.text = "数量:" + good.Number.ToString();

        //品质
        goodsUIBase.qualityText.text = "品质:" + good.Quality.ToString();

        //价格
        goodsUIBase.priceText.text = "价格:" + good.Price.ToString();

        //物品效果
        if (good.MaterialEffet != 0)
        {
            Materiral.Effect _effect = Materiral.FindMaterialEffectByID(good.MaterialEffet);
            goodsUIBase.effect.text = _effect.Name;

            effect = _effect;
        }

        //物品属性
        if (good.Property != null)
        {
            for (int i = 0; i < good.Property.Length; i++)
            {
                if (good.Property[i] == 0)
                {
                    break;
                }

                Materiral.Property _p    = Materiral.GetProNameByProID(good.Property[i]);
                GameObject         p_obj = goodsUIBase.propertys[i];
                p_obj.SetActive(true);
                p_obj.transform.GetChild(0).GetComponent <Text>().text    = _p.Name;
                p_obj.transform.GetChild(1).GetComponent <Image>().sprite = Materiral.GetPropertyIcon(_p.ID);

                Propertys.Add(_p);
            }
        }

        //类型
        goodsUIBase.typeText.text = Materiral.FindTypeNameByID(good.Type).Name;

        string str = Materiral.GetDesByMaterialID(good.MateriralType, good.ID);

        //描述
        goodsUIBase.des.text = System.Text.RegularExpressions.Regex.Unescape(str);
    }
示例#17
0
    void SetRecipeNameInShop(object parameter)
    {
        Parameter.Box p = (Parameter.Box)parameter;
        //显示当前上架的物品
        if (p.obj != null)
        {
            CharBag.Goods currentGoods = (CharBag.Goods)p.obj;

            Image  _image  = shopGoods.transform.Find("Image").GetComponent <Image>();
            Text   _text   = shopGoods.transform.Find("Text").GetComponent <Text>();
            Button _button = shopGoods.transform.Find("Button").GetComponent <Button>();

            _text.text = "当前上架的商品:";
            _text.transform.localPosition = new Vector3(_text.transform.position.x, 50, _text.transform.position.z);
            _image.gameObject.SetActive(true);
            _image.sprite = Materiral.GetMaterialIcon(currentGoods.MateriralType, currentGoods.ID);
            EventTriggerListener.Get(_image.gameObject).parameter          = p;
            EventTriggerListener.Get(_image.gameObject).onClickByParameter = ShowMateriralInfo;

            _button.gameObject.SetActive(true);
            EventTriggerListener.Get(_button.gameObject).parameter          = p;
            EventTriggerListener.Get(_button.gameObject).onClickByParameter = p.callbackByEvent;
        }

        //创建物品列表
        for (int i = 0; i < _bagList.Count; i++)
        {
            CharBag.Goods _map = (CharBag.Goods)_bagList[i];

            //筛选物品,特殊物品不显示
            if (_map.MateriralType > 1)
            {
                continue;
            }

            GameObject button = Instantiate(btn_menu);
            button.transform.SetParent(_fitter.transform, false);

            button.name = _map.ID.ToString();
            button.transform.Find("Text").GetComponent <Text>().text     = _map.Name;
            button.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(_map.MateriralType, _map.ID);

            //显示数量
            button.transform.Find("num").gameObject.SetActive(true);
            button.transform.Find("num/Text").GetComponent <Text>().text = _map.Number.ToString();

            //显示价格
            button.transform.Find("PriceBoard").gameObject.SetActive(true);
            button.transform.Find("PriceBoard/Text").GetComponent <Text>().text = _map.Price.ToString();

            //设置参数容器中的参数
            Parameter.Box _p = new Parameter.Box();
            _p.ID  = p.ID;
            _p.obj = _map;

            //设置点击事件
            OnClickInScorll.Get(button.transform).parameter          = _p;
            OnClickInScorll.Get(button.transform).onClickByParameter = p.callback;
            OnClickInScorll.Get(button.transform).onHoldByParameter  = ShowMateriralInfo;

            //添加背包进入筛选背包列表
            f_BagList.Add(_map);
        }

        //调整列表为置顶
        if (f_BagList.Count > 5)
        {
            setGird();
        }

        StartCoroutine(SetListToTop());
    }
示例#18
0
    //通过进入地图的id筛选出道具,然后通过权重选出拾取的东西。
    //如果以后会有专门进入地图的设定的话,则可以吧判断地图id筛选道具列表的方法单独移出。
    public void CollectionAction(int ap, RectTransform rect)
    {
        Debug.Log("mine:" + ap);

        //筛选出可以掉落的道具
        int       mapid = ap;
        ArrayList List  = new ArrayList();

        int max = 0;

        foreach (CollectionMap materiral in CollectionList)
        {
            if (materiral.Map == mapid)
            {
                List.Add(materiral);
                //获取随机范围
                max += materiral.Weight;
            }
        }

        //随机权重,选出拾取哪个道具
        CharBag.Goods dropMa = new CharBag.Goods();
        dropMa.Property = new int[4];

        int point = Random.Range(1, max);
        int check = 0;

        foreach (CollectionMap materiral in List)
        {
            check += materiral.Weight;

            if (check >= point)
            {
                //指定掉落的材料
                dropMa.MateriralType = materiral.MateriralType;

                dropMa.ID = materiral.ID;
                //指定数量,后期会修改为需要指定数量
                dropMa.Number = 1;

                //随机品质
                dropMa.Quality = Random.Range(materiral.RandomQuality[0], materiral.RandomQuality[1]);

                //随机属性;随机4个属性
                int random_max = 0;
                int propcount  = 0;
                for (int i = 0; i < materiral.RandomProperty.Length / 2; i++)
                {
                    random_max += materiral.RandomProperty[i, 1];
                }

                for (int index = 0; index < 4; index++)
                {
                    if (materiral.PropertyProbability < Random.Range(1, 100))
                    {
                        continue;
                    }

                    int _point = Random.Range(1, random_max);
                    int _check = 0;
                    //指定随机属性
                    for (int i = 0; i < materiral.RandomProperty.Length / 2; i++)
                    {
                        _check += materiral.RandomProperty[i, 1];
                        if (_check >= _point)
                        {
                            dropMa.Property[propcount] = materiral.RandomProperty[i, 0];
                            propcount++;
                            break;
                        }
                    }
                }
                break;
            } //endif
        }     //endforech

        //获取名称
        if (dropMa.MateriralType == 0)
        {
            Materiral.Items dorp_item = Materiral.FindItemByID(dropMa.ID);
            dropMa.Name = dorp_item.Name;
            //设定基础价格,之后还需要计算
            dropMa.Price = dorp_item.Price;

            //获取type
            dropMa.Type = Materiral.GetTypeByMaterialID(dropMa.MateriralType, dropMa.ID);
        }   //item
        else if (dropMa.MateriralType == 1)
        {
            Materiral.Minds drop_mind = Materiral.FindMindByID(dropMa.ID);
            dropMa.Name = drop_mind.Name;
            //设定基础价格,之后还需要计算
            dropMa.Price = drop_mind.Price;

            //获取type
            dropMa.Type = Materiral.GetTypeByMaterialID(dropMa.MateriralType, dropMa.ID);
        }   //mind

        //计算价格
        dropMa = CharBag.SetPrice(dropMa);
        //添加物品
        dropMa.UID = CharBag.AddGoods(dropMa);

        questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.CollectGoods, dropMa, ap);
        //更新物品信息
        PlayerInfo.AddGoodsInfo(dropMa.MateriralType, dropMa.ID, PlayerInfo.GoodsInfoType.CollectCount);
        eventmanager.PreCheckEventList(1);
        ShowMaterialIcon(dropMa, rect);
    }
示例#19
0
    //TODO:add type mode
    void SetRecipeNameFilter(object parameter)
    {
        Parameter.Box p    = (Parameter.Box)parameter;
        Recipe.Slot   slot = (Recipe.Slot)p.obj;
        Dictionary <int, RecipeUI.SlotBox> slotList = (Dictionary <int, RecipeUI.SlotBox>)p.subobj;

        for (int i = 0; i < _bagList.Count; i++)
        {
            CharBag.Goods _map  = new CharBag.Goods();
            CharBag.Goods m_map = (CharBag.Goods)_bagList[i];

            ////////筛选
            if (slot.SlotType == Recipe.SlotTypeList.Material)
            {
                //固定材料
                if (slot.MatType == 0 && slot.MatType == m_map.MateriralType)  //Item
                {
                    if (m_map.ID == slot.MatId)
                    {
                        _map = m_map;
                    }
                }
                else if (slot.MatType == 1 && slot.MatType == m_map.MateriralType)  //Mind
                {
                    if (m_map.ID == slot.MatId)
                    {
                        _map = m_map;
                    }
                }
            }
            else if (slot.SlotType == Recipe.SlotTypeList.MaterialType)
            {
                if (m_map.Type == slot.MatType)
                {
                    _map = m_map;
                }
            }

            //添加进入背包列表,并且创建按钮
            if (_map.Name != null)
            {
                //添加背包进入筛选背包列表
                f_BagList.Add(_map);

                //创建按钮
                GameObject button = Instantiate(btn_menu);
                button.transform.SetParent(_fitter.transform, false);

                button.name = _map.ID.ToString();
                button.transform.Find("Text").GetComponent <Text>().text     = _map.Name;
                button.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(_map.MateriralType, _map.ID);

                //显示数量
                button.transform.Find("num").gameObject.SetActive(true);
                ;               button.transform.Find("num/Text").GetComponent <Text>().text = _map.Number.ToString();

                //设置参数容器中的参数
                Parameter.Box _p = new Parameter.Box();
                _p.ID  = p.ID;
                _p.obj = _map;

                //设置点击事件
                OnClickInScorll.Get(button.transform).parameter          = _p;
                OnClickInScorll.Get(button.transform).onClickByParameter = p.callback;
                OnClickInScorll.Get(button.transform).onHoldByParameter  = ShowMateriralInfo;


                //如果是已经的选中的则不能点击
                foreach (RecipeUI.SlotBox _slot in slotList.Values)
                {
                    if (_map.UID == _slot.slot.UID)
                    {
                        button.name = _map.ID.ToString();
                        button.transform.Find("Text").GetComponent <Text>().text = _map.Name + " <color=red>(E)</color>";
                        button.transform.GetComponent <Image>().color            = Color.gray;

                        OnClickInScorll.Get(button.transform).onClickByParameter = null;
                    }
                }
            }
        }
        //调整列表为置顶
        if (f_BagList.Count > 5)
        {
            setGird();
        }

        StartCoroutine(SetListToTop());
    }
示例#20
0
    public void OpenQuestBoard(int questID, float delyTime)
    {
        QuestManager.QuestBase quest = questManager.GetQuestInfoByID(questID);

        GameObject Board = Instantiate(QuestBoard);

        Board.name = quest.ID.ToString();
        Board.transform.SetParent(QuestCanvas.transform, false);

        //获取面板组件
        Image      iconImage        = Board.transform.Find("QuestBoard/icon").GetComponent <Image>();
        Text       questinfoText    = Board.transform.Find("QuestBoard/questinfo/Text").GetComponent <Text>();
        Text       CompleteinfoText = Board.transform.Find("QuestBoard/questinfo/CompleteText").GetComponent <Text>();
        Text       questnameText    = Board.transform.Find("QuestBoard/questName/questText").GetComponent <Text>();
        Slider     prograssBar      = Board.transform.Find("QuestBoard/questName/progress").GetComponent <Slider>();
        Text       prograssBarText  = Board.transform.Find("QuestBoard/questName/progress/progressText").GetComponent <Text>();
        GameObject closebutton      = Board.transform.Find("QuestBoard/Close").gameObject;
        Text       closebuttonText  = closebutton.transform.Find("Text").GetComponent <Text>();
        GameObject Mask             = Board.transform.Find("Mask").gameObject;
        GameObject questBoardBG     = closebutton.transform.parent.gameObject;
        //Award
        Text  awardGoldNum    = Board.transform.Find("QuestBoard/award/GoldNum").GetComponent <Text>();
        Text  awardExpNum     = Board.transform.Find("QuestBoard/award/ExpNum").GetComponent <Text>();
        Image AwardGoodsImage = Board.transform.Find("QuestBoard/award/Goods").GetComponent <Image>();
        Text  AwardGoodsNum   = Board.transform.Find("QuestBoard/award/GoodsNum").GetComponent <Text>();

        //更新参数
        iconImage.sprite       = Materiral.GetIconByName(quest.Bigicon);
        questinfoText.text     = TextParser.SpecialString(quest.des);
        questnameText.text     = quest.name;
        awardGoldNum.text      = "x" + quest.Award.Gold;
        awardExpNum.text       = "x" + quest.Award.Exp;
        AwardGoodsImage.sprite = Materiral.GetMaterialIcon(quest.Award.Goods[0], quest.Award.Goods[1]);
        AwardGoodsNum.text     = "x" + quest.Award.GoodsNum;

        prograssBar.value    = (float)questManager.GetQuestProgress(quest.ID) / quest.QuestComplete.Num;
        prograssBarText.text = questManager.GetQuestProgress(quest.ID) + "/" + quest.QuestComplete.Num;

        //设置按钮响应
        if (prograssBar.value >= 1)
        {
            if (PlayerInfo.GetNowscene() == quest.Award.TaskPoint)
            {
                //如果在任务地点则设置领取
                closebutton.GetComponent <Image>().color = Color.green;
                closebuttonText.text = "领取";
                EventTriggerListener.Get(closebutton).onClick = GetQuestAward;
            }
            else
            {
                //关闭按钮
                closebutton.GetComponent <Image>().color = Color.white;
                closebuttonText.text  = "关闭";
                CompleteinfoText.text = quest.completedes;
                EventTriggerListener.Get(closebutton).onClick = CloseQuestBoard;
            }
        }
        else
        {
            //关闭按钮
            closebutton.GetComponent <Image>().color = Color.white;
            closebuttonText.text = "关闭";
            EventTriggerListener.Get(closebutton).onClick = CloseQuestBoard;
        }

        questBoardBG.transform.localPosition = new Vector2(0, Screen.height / 2 + 200);
        LeanTween.moveLocalY(closebutton.transform.parent.gameObject, 300, 0.5f).setEaseOutBack().setDelay(delyTime);
    }
示例#21
0
    void InputMaterial(GameObject go, object parameter)
    {
        //如果已经放入则不能再放入
        if (InputBox.Contains(parameter))
        {
            return;
        }

        //判断状态
        if (ripeState != RecipeStat.WaitInput)
        {
            return;
        }

        //改变状态
        ChangeRecipeStat(RecipeStat.Compose);

        InputBox.Add(parameter);
        Parameter.Box pro         = (Parameter.Box)parameter;
        SlotBox       _slot       = (SlotBox)pro.obj;
        GameObject    _slotButton = _slot.button.transform.Find("Bottom/Image").gameObject;

        //合成槽效果
        _slotButton.GetComponent <Image>().color = Color.gray;
        GameObject count = _slot.button.transform.Find("Count").gameObject;

        count.SetActive(true);
        count.transform.GetChild(0).GetComponent <Text>().text = InputBox.Count.ToString();

        //飞向属性栏
        GameObject _btn = Instantiate(btn_recipeSlot);

        _btn.transform.Find("Text").GetComponent <Text>().text            = _slot.slot.Name;
        _btn.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(_slot.slot.MateriralType, _slot.slot.ID);
        _btn.transform.Find("Bottom").GetComponent <Image>().enabled      = false;
        _btn.transform.position   = _slot.button.transform.position;
        _btn.transform.localScale = _slot.button.transform.localScale;
        _btn.transform.SetParent(Plane.transform, false);

        Vector3       _movepos = new Vector3();
        Vector3       tmp      = GetPropertyPos(PropertyBox.Count + 1);
        RectTransform _box     = PropertyListGrid.GetComponent <RectTransform>();

        _movepos = new Vector3(tmp.x + _box.position.x, tmp.y + _box.position.y);

        float actionTime = 0.65f;

        LeanTween.move(_btn.gameObject, _movepos, actionTime).setEase(LeanTweenType.easeOutQuart);
        LeanTween.scale(_btn.gameObject, new Vector3(0.1f, 0.1f, 1), actionTime).setDestroyOnComplete(true);

        //属性栏UI效果
        if (_slot.slot.Property != null)
        {
            AddQualityUIEft(_slot);
            AddPropertyUIEft(_slot.slot);
            ComposeProperty();
        }
        else
        {
            AddQualityUIEft(_slot);
            ShowComposeButton();
            //改变状态
            ChangeRecipeStatByWait(RecipeStat.WaitInput, 0.5f);
            return;
        }
    }
示例#22
0
    //设置合成界面槽的信息和位置
    void SetSlot(Recipe.RecipeMap map)
    {
        int num = map.Slots.Length;

        //TODO:游戏道具的名称和ID,以及按钮的表现效果
        Vector3 base_point  = new Vector3(0, -100, 0);
        int     targetAngel = 0;

        SlotList = new Dictionary <int, SlotBox>();

        for (int i = 0; i < num; i++)
        {
            GameObject recipeSlot = Instantiate(btn_recipeSlot);
            recipeSlot.transform.SetParent(recipeSlotsList.transform, false);

            //设置按钮位置
            targetAngel = 360 / num * i;

            Vector3 target_pos = Quaternion.Euler(0, 0, targetAngel) * base_point;
            recipeSlot.transform.localPosition = target_pos;

            //判断slot中材料的类型,0为固定材料,1为材料种类
            if (map.Slots[i].SlotType == Recipe.SlotTypeList.Material)
            {
                //固定材料
                if (map.Slots[i].MatType == 0)  //Item
                {
                    Materiral.Items _item = Materiral.FindItemByID(map.Slots[i].MatId);

                    recipeSlot.name = i.ToString();
                    recipeSlot.transform.Find("Text").GetComponent <Text>().text            = "[" + _item.Name + "]";
                    recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetIconByName(_item.IMG);
                    recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().color  = new Color(1, 1, 1, 0.5f);
                }
                else if (map.Slots[i].MatType == 1)  //Mind
                {
                    Materiral.Minds _mind = Materiral.FindMindByID(map.Slots[i].MatId);
                    recipeSlot.name = i.ToString();
                    recipeSlot.transform.Find("Text").GetComponent <Text>().text            = "[" + _mind.Name + "]";
                    recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetIconByName(_mind.IMG);
                    recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().color  = new Color(1, 1, 1, 0.5f);
                }
            }
            else if (map.Slots[i].SlotType == Recipe.SlotTypeList.MaterialType)
            {
                //材料类型
                recipeSlot.name = i.ToString();

                int typeID = map.Slots[i].MatType;
                Materiral.MaterialType type = Materiral.FindTypeNameByID(typeID);
                recipeSlot.transform.Find("Text").GetComponent <Text>().text            = "<color=red>[" + type.Name + "]\n(类型)</color>";
                recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetIconByName(type.IMG);
                recipeSlot.transform.Find("Bottom/Image").GetComponent <Image>().color  = new Color(1, 1, 1, 0.5f);
            }
            else
            {
                Debug.Log("Can't find recipe slots!");
            }

            //设置参数容器中的参数
            Parameter.Box parameter = new Parameter.Box();
            parameter.ID       = i; //ID为slot的序号
            parameter.callback = ClickInBag;
            parameter.obj      = map.Slots[i];
            parameter.subobj   = SlotList;

            //添加记录到合成系统用容器中
            SlotBox slot = new SlotBox();
            slot.button = recipeSlot;
            SlotList.Add(i, slot);

            //设置点击事件
            GameObject _slot = recipeSlot.transform.Find("Bottom/Image").gameObject;
            EventTriggerListener.Get(_slot).parameter          = parameter;
            EventTriggerListener.Get(_slot).onClickByParameter = OpenBag;
        }
    }
示例#23
0
    IEnumerator ShowMateriralInList(CharBag.Goods goods)
    {
        yield return(null);

        float      listHeight = MateriralList.Find("ListBox").GetComponent <RectTransform>().rect.height;
        float      listWidth  = MateriralList.Find("ListBox").GetComponent <RectTransform>().rect.width;
        GameObject materiral  = Instantiate(bt_materiral);

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

        materiral.GetComponent <Image>().color = from;
        materiral.transform.Find("Text").GetComponent <Text>().color = from;

        //获取materiral的大小
        RectTransform rec_mat = bt_materiral.GetComponent <RectTransform>();

        //添加进入列表中
        materiral.transform.SetParent(MateriralList.Find("ListBox"), false);
        //materiral.transform.SetAsFirstSibling();

        //如果显示数目超过顶部,则对齐顶部
        if (MateriralList.Find("ListBox").transform.childCount *rec_mat.rect.height > listHeight)
        {
            GameObject materiallist = MateriralList.Find("ListBox").gameObject;
            LeanTween.moveLocalY(materiallist, MateriralList.Find("ListBox").transform.localPosition.y - rec_mat.rect.height, 0.15f);
        }


        float dis        = MateriralList.Find("ListBox").GetComponent <RectTransform>().rect.height / 2; //dis为中心点;抵消local的偏差,使用local0点为中心点
        float button_pos = -dis + (rec_mat.rect.height / 2) + (MateriralList.Find("ListBox").transform.childCount - 1) * rec_mat.rect.height;


        materiral.GetComponent <RectTransform>().localPosition = new Vector3(0, dis + button_pos);

        //由上落下的效果
        LeanTween.moveLocalY(materiral, button_pos, 0.5f).setEase(LeanTweenType.easeOutBounce);

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

        //显示名称
        materiral.transform.Find("Text").GetComponent <Text>().text     = goods.Name;
        materiral.transform.Find("Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);

        EventTriggerListener.Get(materiral).parameter          = goods;
        EventTriggerListener.Get(materiral).onClickByParameter = ShowMateriralInfo;
    }
示例#24
0
    void ClickInBag(GameObject go, object parameter)
    {
        Parameter.Box p     = (Parameter.Box)parameter;
        CharBag.Goods goods = (CharBag.Goods)p.obj;

    #if _Debug
        Debug.Log("ok!!" + "  Name:" + goods.Name + "  ID:" + p.ID);
    #endif

        SlotBox slotbox = new SlotBox();

        if (SlotList.ContainsKey(p.ID))
        {
            slotbox = SlotList[p.ID];
            slotbox.button.transform.Find("Text").GetComponent <Text>().text            = goods.Name;
            slotbox.button.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);
            slotbox.button.transform.Find("Bottom/Image").GetComponent <Image>().color  = new Color(1, 1, 1, 1f);

            //把物品添加到合成系统的slotlist中
            slotbox.slot   = goods;
            SlotList[p.ID] = slotbox;

            //CloseBag
            _bagInstance.CloseBagMenu(gameObject);
        }
    }
示例#25
0
    void InitPlayerInfoData()
    {
        playerinfo.Languege  = "zh";
        playerinfo.MineCount = 0;
        playerinfo.Money     = 0;

        playerinfo.MapInfoList                   = new ArrayList();
        playerinfo.MaterialInfoList              = new MaterialInfo();
        playerinfo.MaterialInfoList.Items        = new ArrayList();
        playerinfo.MaterialInfoList.Minds        = new ArrayList();
        playerinfo.MaterialInfoList.SpecialItems = new ArrayList();
        playerinfo.MaterialInfoList.Propertys    = new ArrayList();
        playerinfo.SenceInfoList                 = new ArrayList();
        playerinfo.CompleteEvents                = new ArrayList();
        playerinfo.QuestList      = new ArrayList();
        playerinfo.CompleteQuests = new ArrayList();

        //初始材料
        foreach (Materiral.Items m in Materiral.GetItemList())
        {
            ItemsInfo _m = new ItemsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.Items.Add(_m);
        }
        foreach (Materiral.Minds m in Materiral.GetMindList())
        {
            MindsInfo _m = new MindsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.Minds.Add(_m);
        }
        foreach (Materiral.SpecialItem m in Materiral.GetSpecialItemList())
        {
            SpecialItemsInfo _m = new SpecialItemsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.SpecialItems.Add(_m);
        }
        foreach (Materiral.Property m in Materiral.GetPropertyList())
        {
            PropertysInfo _m = new PropertysInfo();
            _m.ID          = m.ID;
            _m.RecipeCount = 0;
            playerinfo.MaterialInfoList.Propertys.Add(_m);
        }

        //初始化场景数据
        for (int i = 0; i <= 1; i++)
        {
            SenceInfo s = new SenceInfo();
            s.ID      = i;
            s.InCount = 0;
            playerinfo.SenceInfoList.Add(s);
        }

        ////初始化地图路点数据
        XmlTool   xt    = new XmlTool();
        ArrayList _list = xt.loadPathXmlToArray();

        MapPathManager.Path[] PathList = new MapPathManager.Path[_list.Count];
        _list.CopyTo(PathList);
        xt = null; _list.Clear();

        foreach (MapPathManager.Path p in PathList)
        {
            MapInfo m = new MapInfo();
            m.ID      = p.Map;
            m.InCount = 0;
            playerinfo.MapInfoList.Add(m);
        }
    }
示例#26
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);
        }
    }
示例#27
0
    void StartCompose(GameObject go)
    {
        for (int i = 0; i < recipeSlotsList.transform.childCount; i++)
        {
            if (recipeSlotsList.transform.GetChild(i).gameObject.name == "Compose")
            {
                continue;
            }
            GameObject slot = recipeSlotsList.transform.GetChild(i).gameObject;
            slot.transform.Find("Bottom/Image").GetComponent <Image>().color = Color.white;
            slot.transform.Find("Bottom").GetComponent <Image>().enabled     = false;
            slot.transform.Find("Text").GetComponent <Text>().text           = "";
            slot.transform.Find("Count").gameObject.SetActive(false);
        }

        float actionTime = 3f;

        LeanTween.scale(btn_Compose.gameObject, new Vector3(0.1f, 0.1f, 0.1f), 0.1f).setEase(LeanTweenType.easeInBack).setOnComplete(
            () =>
        {
            btn_Compose.gameObject.SetActive(false);
        });

        ComposeMask.SetActive(true);
        Color c = recipeSlotsList.GetComponent <Image>().color;

        recipeSlotsList.GetComponent <Image>().color = new Color(c.r, c.g, c.b, 0);
        Color m = ComposeMask.GetComponent <Image>().color;

        //渐现效果
        LeanTween.value(ComposeMask.gameObject, c, new Color(m.r, m.g, m.b, 0.7f), actionTime * 0.1f).setOnUpdate(
            (Color col) =>
        {
            ComposeMask.GetComponent <Image>().color = col;
        }
            );
        LeanTween.value(recipeSlotsList.gameObject, c, new Color(c.r, c.g, c.b, 0), actionTime * 0.1f).setOnUpdate(
            (Color col) =>
        {
            recipeSlotsList.GetComponent <Image>().color = col;
        }
            );
        //上升效果
        LeanTween.moveY(recipeSlotsList.gameObject, Screen.height / 2, actionTime * 0.5f).setEase(LeanTweenType.easeOutQuad);
        //旋转效果
        LeanTween.rotateZ(recipeSlotsList.gameObject, 360 * 10, actionTime).setEase(LeanTweenType.easeInOutQuad);
        LeanTween.scale(recipeSlotsList.gameObject, new Vector3(1.3f, 1.3f, 1.3f), actionTime * 0.7f).setEase(LeanTweenType.easeOutQuad).setOnComplete(
            () =>
        {
            LeanTween.scale(recipeSlotsList.gameObject, new Vector3(0.1f, 0.1f, 0.1f), actionTime * 0.3f).setEase(LeanTweenType.easeInBack).setOnComplete(
                () =>
            {
                CharBag.Goods goods = CreateGoods();
                btn_startRecipe.gameObject.SetActive(true);
                btn_startRecipe.transform.Find("Text").GetComponent <Text>().text = "收取";
                recipeSlotsList.gameObject.SetActive(false);
                EventTriggerListener.Get(btn_startRecipe.gameObject).onClick = CloseRecipe;

                targetgoods = Instantiate(btn_recipeSlot);
                targetgoods.transform.SetParent(recipeUI.transform, false);
                targetgoods.transform.SetAsLastSibling();
                targetgoods.transform.position   = recipeSlotsList.transform.position;
                targetgoods.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                LeanTween.scale(targetgoods, new Vector3(1.5f, 1.5f, 1.5f), 1f).setEase(LeanTweenType.easeOutBack);

                targetgoods.transform.Find("Text").GetComponent <Text>().text            = goods.Name;
                targetgoods.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);

                GameObject _targetButton = targetgoods.transform.Find("Bottom/Image").gameObject;
                EventTriggerListener.Get(_targetButton).parameter          = goods;
                EventTriggerListener.Get(_targetButton).onClickByParameter = ShowMateriralInfo;
            });
        }
            );
    }