Esempio n. 1
0
            private void OnItemToggleClicked()
            {
                UIToggle toggle = UIToggle.current;

                if (toggle.value == false)
                {
                    return;
                }

                OperationRedeemCommodity commodity = (OperationRedeemCommodity)toggle.Param;

                mCurrentCommodity = commodity;

                if (commodity == null)
                {
                    return;
                }

                mCommodityNameLabel.text        = GoodsHelper.GetGoodsOriginalNameByTypeId(commodity.IconGoodsId);
                mCommodityDescriptLabel.text    = GoodsHelper.GetGoodsDescriptionByTypeId(commodity.IconGoodsId);
                mCostMoneyTypeSprite.spriteName = UIWidgetHelp.GetMoneySpriteName(commodity.PriceType);
                mBuyNumberInput.value           = "1";

                UpdateCostMoneyLabel();
            }
Esempio n. 2
0
        /// <summary>
        /// 判断是否满足组件的条件(图片名称,文本内容)
        /// </summary>
        /// <param name="widget"></param>
        /// <returns></returns>
        public bool MatchComponent(GameObject widget, string path)
        {
            var pathParams = path.Split(new char[] { ':' });

            if (pathParams.Length <= 2) //没有组件条件,当做满足处理
            {
                return(true);
            }
            if (pathParams.Length <= 3) //配置格式错误
            {
                return(false);
            }

            var componentType  = pathParams[2];
            var componentValue = pathParams[3];

            if (componentType == "Image")
            {
                Image image = widget.GetComponent <Image>();
                return(image != null && image.sprite.name == componentValue);
            }
            else if (componentType == "Text")
            {
                Text text = widget.GetComponent <Text>();
                return(text != null && text.text == DBConstText.GetText(componentValue));
            }
            else if (componentType == "GoodsNameText")
            {
                Text text = widget.GetComponent <Text>();
                uint goodsId;
                if (!uint.TryParse(componentValue, out goodsId))
                {
                    return(false);
                }
                return(text != null && text.text == GoodsHelper.GetGoodsOriginalNameByTypeId(goodsId));
            }
            if (componentType == "RawImage")
            {
                RawImage rawImage = widget.GetComponent <RawImage>();
                return(rawImage != null && rawImage.mainTexture.name == componentValue);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public static string FillTemplateByContentList(string template, string[] param_list)
        {
            if (param_list.Length <= 0)
            {
                return(template);
            }
            if (string.IsNullOrEmpty(template))
            {
                return(string.Empty);
            }

            int index = 0;

            return(mNoticeRegex.Replace(template, new MatchEvaluator(
                                            delegate(Match match)
            {
                string ret = string.Empty;
                if (index >= param_list.Length)
                {
                    return ret;
                }

                string content = param_list [index];
                string target = match.ToString();
                if (target.Length >= 3)
                {
                    target = target.Substring(1, target.Length - 2);
                    EFillType contentType = (EFillType)(int.Parse(target));
                    uint contentNum = 0xffffffff;
                    try
                    {
                        contentNum = Convert.ToUInt32(content);
                    } catch
                    {
                        // Do nothing.
                    }

                    switch (contentType)
                    {
                    // 怪物名字是后端未经过翻译就发过来的,要翻译一下
                    case EFillType.MONSTER_NAME:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;

                    // 玩法场景名字是后端未经过翻译就发过来的,要翻译一下
                    case EFillType.ACTIVITY_SCENE_NAME:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;

                    case EFillType.COLOR_TYPE:
                        ret = GoodsHelper.GetGoodsColor(contentNum);
                        break;

                    case EFillType.CHAT_GOODS_TYPELINK:         // 物品超链接
                        {
                            if (param_list.Length >= 3)
                            {
                                uint playerId = Convert.ToUInt32(param_list[index - 2]);
                                uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                                ulong goods_oid = Convert.ToUInt64(content);

                                uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                                string color_str = GoodsHelper.GetGoodsColor(color_type);
                                string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);

                                uint goodsType = GoodsHelper.GetGoodsType(goods_gid);
                                if (goodsType == GameConst.GIVE_TYPE_EQUIP ||        // 装备
                                    goodsType == GameConst.GIVE_TYPE_RIDE_EQUIP ||   // 坐骑装备
                                    goodsType == GameConst.GIVE_TYPE_MAGIC_EQUIP ||  // 法宝装备
                                    goodsType == GameConst.GIVE_TYPE_DECORATE ||     // 饰品
                                    goodsType == GameConst.GIVE_TYPE_ELEMENT_EP ||   // 元素装备
                                    goodsType == GameConst.GIVE_TYPE_GOD_EQUIP ||    // 神兵
                                    goodsType == GameConst.GIVE_TYPE_ARTIFACT_EP ||  // 神器装备
                                    goodsType == GameConst.GIVE_TYPE_FIVE_ELEM)      // 五行战印
                                {
                                    ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_20"), color_str, goods_name);
                                    ret = ret + "{" + playerId + "," + goods_oid + "," + goods_gid + "})";
                                }
                                else
                                {
                                    ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_21"), color_str, goods_name);
                                    ret = ret + "{" + playerId + "," + goods_gid + "})";
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.CLIENT_GOODS_TYPELINK:       // 客户端物品超链接
                        {
                            uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                            uint goods_oid = contentNum;

                            uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                            string color_str = GoodsHelper.GetGoodsColor(color_type);
                            string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);
                            ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_22"), color_str, goods_name);
                            ret = ret + "{" + content + "})";
                        }
                        break;

                    case EFillType.GOODS_GID:
                        ret = string.Empty;
                        break;

                    case EFillType.HIDE_PLAYER_ID:
                        ret = string.Empty;
                        break;

                    case EFillType.GOODS_GID_NEW:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint playerId = Convert.ToUInt32(param_list[index - 1]);
                                uint goods_gid = Convert.ToUInt32(param_list[index]);

                                uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                                string color_str = GoodsHelper.GetGoodsColor(color_type);
                                string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);
                                ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_21"), color_str, goods_name);
                                ret = ret + "{" + playerId + "," + goods_gid + "})";
                            }
                            else
                            {
                                ret = content;
                            }

                            break;
                        }

                    case EFillType.PET_ID:     // 守护ID(显示带守护品质颜色的守护名字)
                        {
                            uint pet_id = Convert.ToUInt32(content);
                            var pet_info = DBManager.Instance.GetDB <DBPet>().GetOnePetInfo(pet_id);
                            if (pet_info != null)
                            {
                                string color_str = GoodsHelper.GetGoodsColor(pet_info.Quality + 1);    //守护品质颜色和物品相差1
                                string actor_name = ActorHelper.GetActorName(pet_info.Actor_id);
                                ret = string.Format("{0}{1}</color>", color_str, actor_name);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.TITLE_ID:
                        {
                            uint title_id = Convert.ToUInt32(content);
                            var title_info = DBManager.Instance.GetDB <DBHonor>().GetData(title_id);
                            if (title_info != null)
                            {
                                string color_str = GoodsHelper.GetGoodsColor(title_info.Quality);
                                string title_name = title_info.Name;
                                ret = string.Format("{0}{1}</color>", color_str, title_name);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.QUAL_WORD:
                        {
                            uint qual = Convert.ToUInt32(content);
                            string color_str_name = GoodsHelper.GetGoodsColorName(qual);
                            string color_str = GoodsHelper.GetGoodsColor(qual);
                            ret = string.Format("{0}{1}</color>", color_str, color_str_name);
                        }
                        break;

                    case EFillType.TRANSFER_LV:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint init_vocation = Convert.ToUInt32(param_list[index]);
                                uint transfer_lv = Convert.ToUInt32(param_list[index - 1]);
                                object[] param = { transfer_lv, init_vocation };
                                System.Type[] returnType = { typeof(string) };
                                object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "TransferMgr_GetVocationName", param, returnType);
                                if (objs != null && objs.Length > 0 && objs[0] != null)
                                {
                                    ret = (string)objs[0];
                                }
                                else
                                {
                                    ret = content;
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.InitVocation:
                        ret = string.Empty;
                        break;

                    case EFillType.SHOW_TYPE_TO_NAME:     //外显系统ID =>外显系统名字
                        {
                            uint show_type = Convert.ToUInt32(param_list[index]);
                            object[] param = { show_type };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetShowName", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_PARAM:    //外显系统ID => 与25一起使用,组成外显系统的外观名字
                        {
                            ret = string.Empty;
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_FACADE_ID:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint facade_id = Convert.ToUInt32(param_list[index]);
                                uint show_type = Convert.ToUInt32(param_list[index - 1]);
                                object[] param = { show_type, facade_id };
                                System.Type[] returnType = { typeof(string) };
                                object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetFacadeName", param, returnType);
                                if (objs != null && objs.Length > 0 && objs[0] != null)
                                {
                                    ret = (string)objs[0];
                                }
                                else
                                {
                                    ret = content;
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_SYS_ID:       //外显系统ID =>外显系统ID
                        {
                            uint show_type = Convert.ToUInt32(param_list[index]);
                            object[] param = { show_type };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetSysIdStr", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.FASHION_NAME:       //时装
                        {
                            uint fashionId = Convert.ToUInt32(param_list[index]);
                            object[] param = { fashionId };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "FashionManager_GetFashionNameWithColor", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.MALL_NAME:     //商城名字
                        {
                            uint mall_id = Convert.ToUInt32(param_list[index]);
                            var mall_tmpl = xc.DBManager.Instance.GetDB <DBMallType>().GetOneItem(mall_id);
                            if (mall_tmpl != null)
                            {
                                //string color_str = GoodsHelper.GetGoodsColor(mall_tmpl);
                                string tmall_name = mall_tmpl.Name;
                                //ret = string.Format("{0}{1}</color>", color_str, tmall_name);
                                ret = tmall_name;
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.ESCORT_TASK_ID:     //护送任务的id
                        {
                            uint taskId = Convert.ToUInt32(param_list[index]);
                            TaskDefine taskDefine = TaskDefine.MakeDefine(taskId);
                            if (taskDefine != null)
                            {
                                ret = taskDefine.GetFollowNpcName(0);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.INSTANCE_ID:     //副本id
                        {
                            uint instanceId = Convert.ToUInt32(param_list[index]);
                            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
                            if (instanceInfo != null)
                            {
                                ret = instanceInfo.mName;
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.GODWARE_ID:    //神器id
                        {
                            uint god_ware_id = Convert.ToUInt32(param_list[index]);
                            object[] param = { god_ware_id };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GodWareManager_GetGodWareName", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.TIMEFORMAT:
                        int time = Convert.ToInt32(param_list[index]);
                        string strShowTime = CommonTool.SecondsToStr_2(time);
                        ret = strShowTime;
                        break;

                    case EFillType.BIG_PACKET:
                        uint bigNum = Convert.ToUInt32(param_list[index]);
                        if (bigNum != 0)
                        {
                            //ret = string.Format("{0}个大红包,", bigNum);
                            ret = string.Format(xc.DBConstText.GetText("RAIN_RED_PACKET_BIG"), bigNum);
                        }
                        else
                        {
                            ret = "";
                        }
                        break;

                    case EFillType.SMALL_PACKET:
                        uint smallNum = Convert.ToUInt32(param_list[index]);
                        if (smallNum != 0)
                        {
                            //ret = string.Format("{0}个小红包,", smallNum);
                            ret = string.Format(xc.DBConstText.GetText("RAIN_RED_PACKET_SMALL"), smallNum);
                        }
                        else
                        {
                            ret = "";
                        }
                        break;

                    case EFillType.MARKET_ID:
                        {
                            uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                            uint goods_oid = contentNum;

                            uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                            string color_str = GoodsHelper.GetGoodsColor(color_type);
                            string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);

                            // 【click={0}[{1}]</color>】(marketGoodsTips=
                            ret = string.Format(xc.TextHelper.GetConstText("GAME_CHAT_CLICK_MARKET_GOODS"), color_str, goods_name);
                            ret = ret + "{" + content + "})";
                        }
                        break;

                    case EFillType.CONTROL_ID:
                        var id = Convert.ToInt32(param_list[index]);
                        ret = SpanServerManager.Instance.GetServerNameByControlServerId((uint)id);
                        break;

                    case EFillType.CHANNEL_ID:
                        ret = ChannelHelper.GetChannelName(param_list[index]);
                        break;

                    default:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;
                    }
                }

                index++;
                return ret;
            }
                                            )));
        }
Esempio n. 4
0
        public string GetStepFixedDescription(int stepIndex)
        {
            var step = GetStep(stepIndex);

            if (step == null || step.Description == null)
            {
                return(string.Empty);
            }

            string result = DBConstText.GetText(step.Description);

            // 对目标名字进行替换
            if (step.Goal == GameConst.GOAL_TALK)
            {
                result = string.Format(result, NpcHelper.GetNpcName(step.InstanceId, step.NpcId));
            }
            else if (step.Goal == GameConst.GOAL_KILL_MON)
            {
                result = string.Format(result, RoleHelp.GetActorName(step.MonsterId));
            }
            else if (step.Goal == GameConst.GOAL_INTERACT)
            {
                result = string.Format(result, RoleHelp.GetActorName(NpcHelper.MakeNpcDefine(step.NpcId).ActorId));
            }
            else if (step.Goal == GameConst.GOAL_KILL_COLLECT)
            {
                result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId));
            }
            else if (step.Goal == GameConst.GOAL_COLLECT_GOODS)
            {
                if (step.MinWorldBossSpecialMonId > 0 && step.MaxWorldBossSpecialMonId > 0)
                {
                    DBSpecialMon dbSpecialMon = DBManager.Instance.GetDB <DBSpecialMon>();
                    uint         minLevel     = dbSpecialMon.GetSpecialMonLevel(step.MinWorldBossSpecialMonId);
                    uint         maxLevel     = dbSpecialMon.GetSpecialMonLevel(step.MaxWorldBossSpecialMonId);
                    result = string.Format(result, minLevel, maxLevel, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId));
                }
                else
                {
                    result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId));
                }
            }
            else if (step.Goal == GameConst.GOAL_WAR_WIN || step.Goal == GameConst.GOAL_WAR_ENTER || step.Goal == GameConst.GOAL_WAR_GRADE)
            {
                result = string.Format(result, InstanceHelper.GetInstanceName(step.InstanceId2));
            }
            else if (step.Goal == GameConst.GOAL_EQUIP_SUBMIT)
            {
                result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep));
            }
            else if (step.Goal == GameConst.GOAL_SECRET_AREA)
            {
                result = string.Format(result, InstanceHelper.GetKungfuGodInstanceName(step.SecretAreaId));
            }
            else if (step.Goal == GameConst.GOAL_TRIGRAM)
            {
                result = string.Format(result, TaskHelper.GetTrigramName(step.TrigramId));
            }
            else if (step.Goal == GameConst.GOAL_EQUIP_WEAR)
            {
                result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep));
            }
            else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH)
            {
                result = string.Format(result, step.EquipStrenghtLv);
            }
            else if (step.Goal == GameConst.GOAL_EQUIP_GEM)
            {
            }
            else if (step.Goal == GameConst.GOAL_PET_LV)
            {
                result = string.Format(result, step.PetLv);
            }
            else if (step.Goal == GameConst.GOAL_GROW_LV)
            {
            }
            else if (step.Goal == GameConst.GOAL_STIGMA_LV)
            {
                DBStigma dbStigma = DBManager.Instance.GetDB <DBStigma>();
                DBStigma.DBStigmaInfo stigmaInfo = dbStigma.GetOneDBStigmaInfo(step.StigmaId);
                if (stigmaInfo != null)
                {
                    string name = stigmaInfo.Name;
                    result = string.Format(result, name);
                }
                else
                {
                    GameDebug.LogError("GetStepFixedDescription error, can not find stigma info by id " + step.StigmaId);
                }
            }
            else if (step.Goal == GameConst.GOAL_DRAGON_SOUL)
            {
                result = string.Format(result, step.ExpectResult);
            }
            else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH_TLV)
            {
                result = string.Format(result, step.EquipStrenghtLv);
            }
            else if (step.Goal == GameConst.GOAL_KILL_BOSS)
            {
                if (step.MonsterLevel > 0)
                {
                    result = string.Format(result, step.ExpectResult, step.MonsterLevel);
                }
                else
                {
                    result = string.Format(result, step.ExpectResult);
                }
            }
            else if (step.Goal == GameConst.GOAL_LIGHT_EQUIP)
            {
                List <string> names = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_light_equip", "id", step.LightEquipLv.ToString(), "desc");
                if (names != null && names.Count > 0)
                {
                    result = string.Format(result, names[0]);
                }
            }
            else
            {
                result = TaskHelper.GetStepFixedDescriptionByLua(step);
            }
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 根据当前档位充值次数来设置ui的显示
        /// </summary>
        /// <param name="pay_item_trans"></param>
        /// <param name="pay_info"></param>
        /// <param name="bought_times"></param>
        /// <param name="limit_times"></param>
        void SetPayItemInfo(Transform pay_item_trans, DBPay.PayItemInfo pay_info, uint bought_times, uint limit_times)
        {
            if (pay_item_trans == null || pay_info == null)
            {
                return;
            }

            // 元宝数量
            var gold_num_text = GetChildComponent <Text>(pay_item_trans, "GoldTag/GoldNum");

            if (gold_num_text != null)
            {
                gold_num_text.text = string.Format("{0}", pay_info.Diamond);
            }

            // 购买价格
            var price_num_text = GetChildComponent <Text>(pay_item_trans, "PriceNum");

            if (price_num_text != null)
            {
                var price_str = CommonTool.ParsePrice(pay_info.RmbLow);
                price_num_text.text = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_98"), price_str);
            }

            // 充值图标
            var icon_image = GetChildComponent <Image>(pay_item_trans, "Treasure");

            if (icon_image != null && !string.IsNullOrEmpty(pay_info.Icon))
            {
                var ori_sprite = icon_image.sprite;
                var new_sprite = LoadSprite(pay_info.Icon);
                if (ori_sprite != new_sprite)
                {
                    icon_image.sprite = new_sprite;
                    icon_image.SetNativeSize();
                }
            }

            // 按钮事件
            var button = pay_item_trans.GetComponent <Button>();

            if (button != null)
            {
                button.onClick.RemoveAllListeners();
                button.onClick.AddListener(() => { OnClickPayButton(pay_info); });
            }

            var limit_trans       = pay_item_trans.Find("LimitTag");
            var present_tag_trans = pay_item_trans.Find("PresentTag");
            var gold_tag_trans    = pay_item_trans.Find("GoldTag");

            // 限购物品类型
            if (pay_info.LimitGID != 0)
            {
                if (present_tag_trans != null)
                {
                    present_tag_trans.gameObject.SetActive(false);
                }

                if (gold_tag_trans != null)
                {
                    gold_tag_trans.gameObject.SetActive(false);
                }

                if (limit_trans == null)
                {
                    return;
                }

                limit_trans.gameObject.SetActive(true);



                uint state = ChargeManager.GetInstance().GetLimitState();
                //可购买0,可领取1,已领取2


                var limit_name_text = GetChildComponent <Text>(limit_trans, "LimitName");
                if (limit_name_text != null)
                {
                    limit_name_text.gameObject.SetActive(state == 0);
                    limit_name_text.text = GoodsHelper.GetGoodsOriginalNameByTypeId(pay_info.LimitGID);
                }

                var get_btn = GetChildComponent <Button>(limit_trans, "GetButton");
                if (get_btn != null)
                {
                    get_btn.gameObject.SetActive(state == 1);
                    get_btn.onClick.RemoveAllListeners();
                    get_btn.onClick.AddListener(() =>
                    {
                        C2SBindGoldBoxGet data = new C2SBindGoldBoxGet();
                        NetClient.GetBaseClient().SendData <C2SBindGoldBoxGet>(NetMsg.MSG_BIND_GOLD_BOX_GET, data);
                    });
                }

                var received = GetChildComponent <Transform>(limit_trans, "Received");
                if (received != null)
                {
                    received.gameObject.SetActive(state == 2);
                }

                var redPoint = GetChildComponent <Transform>(limit_trans, "RedPoint");
                if (redPoint != null)
                {
                    redPoint.gameObject.SetActive(ChargeManager.Instance.GetRedPointState());
                }



                if (state == 0)
                {
                    //可购买0
                    var limit_title = GetChildComponent <Text>(limit_trans, "LimitTitle");
                    if (limit_title != null)
                    {
                        limit_title.text = string.Format(DBConstText.GetText("CHARGE_BOX_LAST_TEXT"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_GOLD_NUM"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_DAYS"));
                    }
                }
                else
                {
                    //可领取1 已领取2
                    var limit_title = GetChildComponent <Text>(limit_trans, "LimitTitle");
                    if (limit_title != null)
                    {
                        limit_title.text = string.Format(DBConstText.GetText("CHARGE_BOX_LEAVE_TEXT"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_GOLD_NUM"), ChargeManager.GetInstance().GetLimitedLeftTime());
                    }
                }
            }
            // 充值赠送元宝类型
            else
            {
                if (limit_trans != null)
                {
                    limit_trans.gameObject.SetActive(false);
                }

                if (gold_tag_trans != null)
                {
                    gold_tag_trans.gameObject.SetActive(true);
                }

                if (present_tag_trans == null)
                {
                    return;
                }

                if (pay_info.BonusFirst != 0 || pay_info.BonusOther != 0)
                {
                    var present_object  = GetChildComponent <Transform>(present_tag_trans, "Present");
                    var present2_object = GetChildComponent <Transform>(present_tag_trans, "Present2");
                    var gold_icon       = GetChildComponent <Image>(present_tag_trans, "GoldIcon");
                    var present_text    = GetChildComponent <Text>(present_tag_trans, "PresentNum");

                    // 首次充值
                    if (bought_times == 0)
                    {
                        if (gold_icon != null)
                        {
                            var ori_sprite = gold_icon.sprite;
                            var new_sprite = LoadSprite(LocalPlayerManager.GetMoneySpriteName((int)pay_info.BonusFirstType));
                            if (ori_sprite != new_sprite)
                            {
                                gold_icon.sprite = new_sprite;
                            }
                        }

                        if (pay_info.BonusFirst != 0) // 首充赠送金额
                        {
                            if (present_text != null)
                            {
                                present_text.text = pay_info.BonusFirst.ToString();
                            }

                            if (present_object != null)
                            {
                                present_object.gameObject.SetActive(true);
                            }

                            if (present2_object != null)
                            {
                                present2_object.gameObject.SetActive(false);
                            }

                            present_tag_trans.gameObject.SetActive(true);
                        }
                        else
                        {
                            present_tag_trans.gameObject.SetActive(false);
                        }
                    }
                    // 多次充值
                    else
                    {
                        if (gold_icon != null)
                        {
                            var ori_sprite = gold_icon.sprite;
                            var new_sprite = LoadSprite(LocalPlayerManager.GetMoneySpriteName((int)pay_info.BonusOtherType));
                            if (ori_sprite != new_sprite)
                            {
                                gold_icon.sprite = new_sprite;
                            }
                        }

                        if (pay_info.BonusOther != 0)// 普通赠送金额
                        {
                            if (present_text != null)
                            {
                                present_text.text = pay_info.BonusOther.ToString();
                            }

                            if (present_object != null)
                            {
                                present_object.gameObject.SetActive(false);
                            }

                            if (present2_object != null)
                            {
                                present2_object.gameObject.SetActive(true);
                            }

                            present_tag_trans.gameObject.SetActive(true);
                        }
                        else
                        {
                            present_tag_trans.gameObject.SetActive(false);
                        }
                    }
                }
                else
                {
                    present_tag_trans.gameObject.SetActive(false);
                }
            }

            // ios审核包隐藏首冲赠送的控件

            /*if(GlobalConfig.Instance.IosPackageInfo.Open)
             * {
             *  if (present_tag_trans != null)
             *      present_tag_trans.gameObject.SetActive(false);
             * }*/
            if (SysConfigManager.Instance.CheckSysHasOpened(GameConst.SYS_OPEN_BONUS_PAY) == false)
            {
                if (present_tag_trans != null)
                {
                    present_tag_trans.gameObject.SetActive(false);
                }
            }



            //iphone
            if (AuditManager.Instance.AuditAndIOS())
            {
                LoadMaJiaImage majiaImage = pay_item_trans.gameObject.GetComponent <LoadMaJiaImage>();
                if (majiaImage == null)
                {
                    majiaImage       = pay_item_trans.gameObject.AddComponent <LoadMaJiaImage>();
                    majiaImage.mPath = string.Format("ChargeItem_{0}.png", pay_info.Diamond);
                    majiaImage.SetCallBack(() =>
                    {
                        RawImage rawImage = majiaImage.GetRawImage();
                        if (rawImage != null)
                        {
                            if (icon_image != null)
                            {
                                icon_image.gameObject.SetActive(false);
                            }
                            rawImage.rectTransform.SetAsFirstSibling();
                        }
                    });
                }
            }
        }
Esempio n. 6
0
 public static string GetMoneyNameByConst(ushort moneyType)
 {
     return(GoodsHelper.GetGoodsOriginalNameByTypeId(moneyType));
 }
Esempio n. 7
0
            private void UpdateContent()
            {
                UpdateMoneyLabel();

                ModelHelper.ClearChildren(mCommodityContent);

                const int ITEM_WIDTH  = 168;
                const int ITEM_HEIGHT = 192;

                List <OperationRedeemCommodity> commodites = OperationRedeemManager.Instance.FashionCommodities;

                if (mCurrentShopType == OperationRedeemManager.ShopType.STUFF)
                {
                    commodites = OperationRedeemManager.Instance.StuffCommodities;
                }

                int index = 0;

                foreach (var item in commodites)
                {
                    GameObject itemObject = GameObject.Instantiate(mCommoditySampleItem) as GameObject;
                    itemObject.transform.parent        = mCommodityContent;
                    itemObject.transform.localScale    = Vector3.one;
                    itemObject.transform.localPosition = new Vector3((index % 3) * ITEM_WIDTH, -(index / 3) * ITEM_HEIGHT, 0);

                    UILabel    nameLabel          = ModelHelper.FindChildComponentInHierarchy <UILabel>(itemObject.transform, "NameLabel");
                    UILabel    priceLabel         = ModelHelper.FindChildComponentInHierarchy <UILabel>(itemObject.transform, "PriceLabel");
                    UIToggle   itemToggle         = itemObject.GetComponent <UIToggle>();
                    UISprite   moneyTypeSprite    = ModelHelper.FindChildComponentInHierarchy <UISprite>(itemObject.transform, "MoneyTypeSprite");
                    GameObject limitTimeContainer = ModelHelper.FindChildInHierarchy(itemObject.transform, "LimitTimeContainer").gameObject;

                    Transform iconGoodsRoot = ModelHelper.FindChildComponentInHierarchy <Transform>(itemObject.transform, "IconGoodsRoot");

                    priceLabel.text            = item.Price.ToString();
                    moneyTypeSprite.spriteName = UIWidgetHelp.GetMoneySpriteName(item.PriceType);

                    if (item.EndTime > 0)
                    {
                        limitTimeContainer.SetActive(true);
                    }
                    else
                    {
                        limitTimeContainer.SetActive(false);
                    }

                    GameObject iconGoods = UIWidgetHelp.Instance.CreateGoodsItem(item.IconGoodsId, 0, false, false);
                    iconGoods.transform.parent        = iconGoodsRoot;
                    iconGoods.transform.localPosition = new Vector3(0, 39, 0);
                    iconGoods.transform.localScale    = new Vector3(0.7f, 0.7f, 0.7f);

                    Collider iconCollider = iconGoods.GetComponent <Collider>();
                    if (iconCollider != null)
                    {
                        GameObject.Destroy(iconCollider);
                        iconCollider = null;
                    }

                    nameLabel.text   = GoodsHelper.GetGoodsOriginalNameByTypeId(item.IconGoodsId);
                    itemToggle.Param = item;

                    EventDelegate.Add(itemToggle.onChange, OnItemToggleClicked);

                    if (index == 0)
                    {
                        itemToggle.value = true;
                    }

                    ++index;
                }

                mCommodityScrollView.ResetPosition();

                mReduceButton.gameObject.SetActive(true);
                mAddButton.gameObject.SetActive(true);
                mMaxButton.gameObject.SetActive(true);
            }