Beispiel #1
0
        public void RefreshSwtichBoard()
        {
            //set items
            mPrimary = null;
            int i = 0;

            foreach (var item in WildManager.Instance.mLineAmout)
            {
                if (i >= items.Length)
                {
                    break;
                }
                items[i].Set(item.Key, item.Value);
                items[i].gameObject.SetActive(true);
                if (item.Key == GameConstHelper.GetUint("GAME_WILD_DUNGEON_PRIMARY_ID"))
                {
                    mPrimary = items[i];
                }
                ++i;
            }
            for (int j = i; j < items.Length; j++)
            {
                items[j].gameObject.SetActive(false);
            }

            UIWildSwtichLineItem waitingItem = getItem(WildManager.Instance.mCurrentWaitingLineId);

            if (waitingItem != null)
            {
                labelWaitingNumTip.text = string.Format(xc.DBConstText.GetText("SWITCH_LINE_WAITING_TIP"), waitingItem.labelName.text, WildManager.Instance.mWaitingNum);
            }
            labelWaitingNumTip.gameObject.SetActive(waitingItem != null);
        }
        /// <summary>
        /// 判断帮派篝火能否烤肉
        /// </summary>
        public bool GuildBonfireCheckCanMeat(bool showTips)
        {
            uint num = 0;

            object[]      param      = { };
            System.Type[] returnType = { typeof(uint) };
            object[]      objs       = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GuildBonfireDataManager_GetMeatNum", param, returnType);
            if (objs != null && objs.Length > 0)
            {
                if (objs[0] != null)
                {
                    num = (uint)objs[0];
                }
            }

            uint maxNum = GameConstHelper.GetUint("GAME_GUILD_FIRE_MAX_MEAT_NUM");

            bool ret = false;

            if (num < maxNum)
            {
                ret = true;
            }
            else
            {
                if (showTips == true)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("GUILD_FIRE_GET_MEAT_REACH_MAX"), maxNum));
                }
            }
            return(ret);
        }
 public void Set(uint id, uint num)
 {
     mId = id;
     DBInstance.InstanceInfo info = DBManager.Instance.GetDB <DBInstance>().GetInstanceInfo(id);
     if (id == GameConstHelper.GetUint("GAME_WILD_DUNGEON_PRIMARY_ID"))
     {
         labelName.text = info.mName + string.Format(DBConstText.GetText("PRIMARY_TITLE_SUFFIX"), GameConstHelper.GetUint("GAME_WILD_PRIMARY_BATTLE_POWER"));
     }
     else
     {
         labelName.text = info.mName;
     }
     UIWIldSwitchLine.SetAmount(spriteProgress, num);
     if (WildManager.Instance.mCurrentLineId == id)
     {
         goHead.SetActive(true);
         RoleHelp.GetIconName(Game.GetInstance().LocalPlayerTypeID, texHead);
         goButton.SetActive(false);
     }
     else
     {
         goHead.SetActive(false);
         goButton.SetActive(true);
         if (id == WildManager.Instance.mCurrentWaitingLineId)
         {
             lableButton.text = xc.DBConstText.GetText("IN_QUEUE");
         }
         else
         {
             lableButton.text = xc.DBConstText.GetText("GOTO");
         }
     }
 }
Beispiel #4
0
            private uint GetCurrentBuyNumber()
            {
                uint result = 0;

                uint.TryParse(mBuyNumberInput.value, out result);

                if (result > GameConstHelper.GetUint("meConst.GAME_SHOP_MAX_BUY_NUMBER"))
                {
                    result = GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER");
                    mBuyNumberInput.value = result.ToString();
                }

                return(result);
            }
            protected override void ResetUI()
            {
                base.ResetUI();

                if (mCountDownTimer != null)
                {
                    mCountDownTimer.Destroy();
                }

                mTimeout        = GameConstHelper.GetUint("GAME_OFFLINE_TIMEOUT");
                mTimeText.text  = string.Format("{0}", mTimeout); // 初始化倒计时的显示
                mStartTime      = Time.unscaledTime;
                mCountDownTimer = new Utils.Timer(mTimeout * 1000, false, 1000, OnTimeUpddate);

                Game.Instance.ManualCancelReconnect = false;
            }
Beispiel #6
0
 /// <summary>
 /// 加载指引需要的角色模型
 /// </summary>
 public void PrepareModel(string ani_name)
 {
     m_AnimationName = ani_name;
     if (m_ModelId != null)
     {
         var actor = ActorManager.Instance.GetActor(m_ModelId);
         if (actor != null && string.IsNullOrEmpty(ani_name) == false)
         {
             actor.CrossFade(ani_name);
             float delay_time = actor.GetAnimationLength(m_AnimationName);
             MainGame.HeartBehavior.StartCoroutine(PlayIdle(actor, delay_time, "idle"));
         }
     }
     else
     {
         m_ModelId = ClientModel.CreateClientModelByActorIdForLua(GameConstHelper.GetUint("GAME_GUIDE_MODEL"), OnModelLoaded);
     }
 }
Beispiel #7
0
            private void OnMaxButtonClicked()
            {
                if (mCurrentCommodity == null)
                {
                    return;
                }

                uint money = LocalPlayerManager.Instance.GetMoneyByConst((ushort)mCurrentCommodity.PriceType);
                uint num   = money / mCurrentCommodity.Price;

                if (num < 1)
                {
                    num = 1;
                }

                if (num > GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER"))
                {
                    num = GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER");
                }

                mBuyNumberInput.value = num.ToString();
            }
            /// <summary>
            /// 进行更新检查
            /// </summary>
            /// <returns></returns>
            public IEnumerator StartLogingCheck()
            {
                // 读取游戏常量表的配置
                bool isSupportGrayServer = false;

#if UNITY_IPHONE
                if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER_IOS") > 0)
                {
                    isSupportGrayServer = true;
                }
#else
                if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER") > 0)
                {
                    isSupportGrayServer = true;
                }
#endif

                // 检查当前包是否支持灰度服的更新检查
                if (!GrayServerManager.Instance.IsSupportGrayServer() || !isSupportGrayServer)
                {
                    OnEnterGame();
                    yield break;
                }

                // 上次登录的服务器ID与当前服务器ID相同时,不需要检查灰度服更新
                var lastServerId = GrayServerManager.Instance.GetLoginServer();
                var curServerId  = 0;
                if (GlobalConfig.Instance.LoginInfo != null && GlobalConfig.Instance.LoginInfo.ServerInfo != null)
                {
                    curServerId = GlobalConfig.Instance.LoginInfo.ServerInfo.SId;
                }
                if (lastServerId == curServerId)
                {
                    OnEnterGame();
                    yield break;
                }

                // 记录最新的服务器ID
                GrayServerManager.Instance.RecordLoginServer(curServerId);

#if UNITY_EDITOR
                // editor下使用android的资源来测试
                var server_url = @"http://s01.huiwaninfo.net:8087/XControl/v2/servlet/UpdateCheck?game_mark=zl_cehua&platform=android&appv=2.0.0&libv=0.0.0&imei=359786050902015&device_mark=&cpu=Intel&extend=&api_ver=1.0&res_v=1&res_v=1";
#else
                var server_url = DBOSManager.getOSBridge().getUpdateCheckUrl();
#endif

                // 获取最新资源版本
                GrayServerManager.Instance.SetUpdateURL(server_url);
                yield return(MainGame.HeartBehavior.StartCoroutine(GrayServerManager.Instance.CheckUpdate(curServerId)));

                var updateInfo = GrayServerManager.Instance.UpdateInfo;

                bool needUpdate = false;
                if (updateInfo != null)
                {
                    // 判断是否有更新
                    var versionInfo = VersionInfoManager.Instance.LocalVersionInfo;
                    if (versionInfo != null)
                    {
                        foreach (var info in versionInfo)
                        {
                            var local_version  = info.Value;
                            var server_version = 0;
                            if (updateInfo.TryGetValue(info.Key, out server_version))
                            {
                                if (local_version < server_version)
                                {
                                    needUpdate = true;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (mCheckCoroutine != null)
                {
                    MainGame.HeartBehavior.StopCoroutine(mCheckCoroutine);
                    mCheckCoroutine = null;
                }

                // 有更新时需要重新启动游戏
                if (needUpdate)
                {
                    ui.UIWidgetHelp.GetInstance().ShowNoticeDlg("检测到游戏资源有更新,请重启游戏进行更新操作。", (x) =>
                    {
                        DBOSManager.getOSBridge().reboot();
                    });
                }
                else
                {
                    OnEnterGame();
                }
            }
Beispiel #9
0
    void UpdateUI()
    {
        if (mTimer != null)
        {
            mTimer.Destroy();
            mTimer = null;
        }

        if (mActivityIds == null)
        {
            return;
        }
        Transform timerTextTrans = this.transform.Find("SysBtn").Find("TimerText");

        if (timerTextTrans == null)
        {
            GameDebug.LogError("UIGuildLeagueSysBtn UpdateTimerText error!!! Can not find TimerText!!!");
            return;
        }

        UISysConfigBtn btn = this.gameObject.GetComponent <UISysConfigBtn>();


        //当预告开启的时候  预备和资格的  icon不允许显示
        if (ActivityHelper.IsActivityOpen(GameConst.SYS_OPEN_LEAGUE_PRE_SHOW))
        {
            btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen);
            return;
        }


        // 系统是否开放
        bool sysIsOpen = false;

        foreach (uint activityId in mActivityIds)
        {
            if (SysConfigManager.Instance.CheckSysHasOpenIgnoreActivity(activityId))
            {
                sysIsOpen = true;
                break;
            }
        }

        if (sysIsOpen == false)
        {
            btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen);
            return;
        }

        bool todayIsOpen = false;

        foreach (uint activityId in mActivityIds)
        {
            if (ActivityHelper.GetActivityInfo <bool>(activityId, "TodayIsOpen") == true)
            {
                todayIsOpen = true;
                break;
            }
        }
        if (todayIsOpen == false)
        {
            //this.gameObject.SetActive(false);
            btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen);
        }
        else
        {
            DateTime curDateTime = Game.Instance.GetServerDateTime();
            uint     serverTime  = Game.Instance.ServerTime;

            List <uint> startShowBtnTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_START_SHOW_BTN_TIME"); // 开始显示系统按钮时间(5点)
            List <uint> confirmTimeStr      = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CONFIRM_TIME");        // 确认对战表时间(19点)
            List <uint> openTimeStr         = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_OPEN_TIME");           // 活动开启时间(21点)
            List <uint> closeTimeStr        = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CLOSE_TIME");          // 活动关闭时间(22点)

            uint startShowBtnTimeHour   = startShowBtnTimeStr[0];
            uint startShowBtnTimeMinute = startShowBtnTimeStr[1];
            uint confirmTimeHour        = confirmTimeStr[0];
            uint confirmTimeMinute      = confirmTimeStr[1];
            uint openTimeHour           = openTimeStr[0];
            uint openTimeMinute         = openTimeStr[1];
            uint closeTimeHour          = closeTimeStr[0];
            uint closeTimeMinute        = closeTimeStr[1];

            long startShowBtnTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)startShowBtnTimeHour, (int)startShowBtnTimeMinute, 0));
            long confirmTimestamp      = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)confirmTimeHour, (int)confirmTimeMinute, 0));
            long openTimestamp         = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)openTimeHour, (int)openTimeMinute, 0));
            long roundTwoOpenTimestamp = openTimestamp + GameConstHelper.GetUint("GAME_GUILD_LEAGUE_ROUND_TWO_AFTER") * 60;
            long closeTimestamp        = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)closeTimeHour, (int)closeTimeMinute, 0));

            long endTimestamp = 0;

            if (serverTime < startShowBtnTimestamp) // 5点前
            {
                //this.gameObject.SetActive(false);
                btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen);
            }
            else if (serverTime < confirmTimestamp) // 确认参赛资格前
            {
                //this.gameObject.SetActive(true);
                btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
                endTimestamp = openTimestamp;
            }
            else if (serverTime < openTimestamp)                         // 第一轮比赛开启前
            {
                if (GuildLeagueManager.Instance.CanJoinLeague() == true) // 有参赛资格
                {
                    //this.gameObject.SetActive(true);
                    btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
                    endTimestamp = openTimestamp;
                }
                else // 没有参赛资格
                {
                    //this.gameObject.SetActive(true);
                    btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
                }
            }
            else if (serverTime < roundTwoOpenTimestamp)                   // 第二轮比赛开启前
            {
                if (GuildLeagueManager.Instance.RoundOneIsOver() == false) // 第一轮还没结束
                {
                    //this.gameObject.SetActive(true);
                    btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
                }
                else  // 第一轮已经结束
                {
                    //this.gameObject.SetActive(true);
                    btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
                    endTimestamp = roundTwoOpenTimestamp;
                }
            }
            else if (serverTime < closeTimestamp)   // 22点前
            {
                //this.gameObject.SetActive(true);
                btn.SetSysBtnState(UISysConfigBtn.SysState.Open);
            }
            else // 22点后
            {
                //this.gameObject.SetActive(false);
                btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen);
            }

            Text timerText = this.transform.Find("SysBtn").Find("TimerText").GetComponent <Text>();
            if (endTimestamp > 0)
            {
                timerText.gameObject.SetActive(true);
                if (endTimestamp > serverTime)
                {
                    long timeOffset = endTimestamp - serverTime;
                    timerText.text = Utils.Timer.GetFMTTime2(1000f * timeOffset);
                    mTimer         = new Utils.Timer(timeOffset * 1000, false, 1000,
                                                     (remainTime) =>
                    {
                        if (remainTime > 0)
                        {
                            timerText.text = Utils.Timer.GetFMTTime2(remainTime);
                        }
                        else
                        {
                            timerText.text = "";
                            timerText.gameObject.SetActive(false);

                            UpdateUI();
                        }
                    });
                }
                else
                {
                    GameDebug.LogError("Init UIGuildLeagueSysBtn error, end timestamp is early then cur time!!!");
                }
            }
            else
            {
                timerText.gameObject.SetActive(false);
            }
        }

        ShowEffect(RedPointDataMgr.Instance.GetRedPointVisible(70));
    }
Beispiel #10
0
    /// <summary>
    /// 随机设置将要攻击的技能
    /// </summary>
    public virtual void SetRandomSkill()
    {
        if (mRunningProperty.TargetSkill != null)
        {
            return;
        }

        if (mRunningProperty.SelfActor.UnitType != EUnitType.UNITTYPE_PLAYER)
        {
            int skillCount = mRunningProperty.SelfActor.GetSkillCount();
            if (skillCount <= 0)
            {
                Debug.LogError("AIBaseFunction::SetRandomSkill failed, do not have any skill");
                return;
            }

            Actor.SkillCastInfo skillInfo;
            ushort[]            skillRates = new ushort[skillCount];
            ushort allRate = 0;
            for (int i = 0; i < skillCount; ++i)
            {
                skillInfo = RunningProperty.SelfActor.GetSkillIDByIndex(i);

                if (skillInfo == null)
                {
                    skillRates[i] = 0;
                    continue;
                }

                Skill skill = RunningProperty.SelfActor.GetSelfSkill(skillInfo.muiID);

                if (skill == null)
                {
                    skillRates[i] = 0;
                    continue;
                }

                if (RunningProperty.SelfActor.AttackCtrl.IsSkillCanCast(skill, 0) == false)
                {
                    skillRates[i] = 0;
                    continue;
                }

                skillRates[i] = (ushort)(skillInfo.mbtCastRate);
                allRate      += skillInfo.mbtCastRate;
            }

            uint skillId = 0xffffffff;

            int rand       = UnityEngine.Random.Range(0, allRate);
            int skillIndex = 0;

            ushort currentTotal = 0;
            for (int i = 0; i < skillRates.Length; i++)
            {
                currentTotal += skillRates[i];

                if (rand <= currentTotal)
                {
                    skillIndex = i;
                    break;
                }
            }

            skillId = RunningProperty.SelfActor.GetSkillIDByIndex(skillIndex);

            if (skillId != 0xffffffff)
            {
                //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId);
                RunningProperty.TargetSkillId = skillId;
            }

            if (RunningProperty.TargetSkill == null)
            {
                Debug.LogError(string.Format("BehaviourAI::SetRandomSkill failed,{0} can not get skill:{1}", RunningProperty.SelfActor.TypeIdx, skillId));
                return;
            }
            else
            {
                return;
            }
        }
        else
        {
            List <uint> skillIds = new List <uint>();

            Dictionary <uint, Skill> .ValueCollection learnedSkills = SkillManager.GetInstance().GetLocalSkill();

            foreach (Skill skill in learnedSkills)
            {
                if (mRunningProperty.SelfActor.AttackCtrl.IsSkillCanCast(skill, 0) == false)
                {
                    continue;
                }

                if (skill != null)
                {
                    skillIds.Add(skill.SkillID);
                }
            }

            if (skillIds.Count <= 0)
            {
                string normalSkillRaw = string.Format("GAME_AI_NORMAL_SKILL_ID_ROLE_{0}", (int)RunningProperty.SelfActor.VocationID);
                uint   skillId        = GameConstHelper.GetUint(normalSkillRaw);

                if (skillId > 0)
                {
                    //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId);
                    skillId = skillId;
                    UINotice.Instance.ShowMessage(xc.DBConstText.GetText("AI_TURN_TO_NORMAL_SKILL_TIPS"));
                }
            }

            // 随机技能
            int randIndex = UnityEngine.Random.Range(0, skillIds.Count);

            if (randIndex < skillIds.Count)
            {
                uint skillId = skillIds[randIndex];

                //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId);
                skillId = skillId;
            }
        }

        return;
    }
Beispiel #11
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();
                        }
                    });
                }
            }
        }
Beispiel #12
0
 private void Update()
 {
     if (mPrimary == null)
     {
         return;
     }
     mPrimary.EnableGO(LocalPlayerManager.Instance.LocalActorAttribute.BattlePower <= GameConstHelper.GetUint("GAME_WILD_PRIMARY_BATTLE_POWER"));
 }