/// <summary>
    /// 初始化数据
    /// </summary>
    public void InitData()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("WeeklySignScript_hotfix", "InitData"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.WeeklySignScript_hotfix", "InitData", null, null);
            return;
        }

        totalSignDays = SignData.SignWeekDays;


        for (int i = 0; i < 7; i++)
        {
            Transform child = content.transform.GetChild(i);
            signObjects.Add(child.gameObject);
        }

        if (_signItems == null || _signItems.Count != signObjects.Count)
        {
            LogUtil.Log("数据初始化错误");
            return;
        }
    }
    public void onReceive_HuaFeiSuiPianDuiHuan(string json)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Activity_huafeisuipian_Script_hotfix", "onReceive_HuaFeiSuiPianDuiHuan"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Activity_huafeisuipian_Script_hotfix", "onReceive_HuaFeiSuiPianDuiHuan", null, json);
            return;
        }

        NetLoading.getInstance().Close();

        JsonData jd = JsonMapper.ToObject(json);

        int code = (int)jd["code"];

        if (code == (int)TLJCommon.Consts.Code.Code_OK)
        {
            int duihuan_id = (int)jd["duihuan_id"];
            HuaFeiSuiPianDuiHuanDataContent temp = HuaFeiSuiPianDuiHuanData.getInstance().getDataById(duihuan_id);

            {
                GameUtil.changeData(temp.Synthesis_id, temp.Synthesis_num);
                GameUtil.changeData(temp.material_id, -temp.material_num);

                ShowRewardPanelScript.Show(temp.Synthesis_id.ToString() + ":" + temp.Synthesis_num.ToString(), false);
            }

            refreshMyMaterialNum();
        }
        else
        {
            string msg = (string)jd["msg"];

            ToastScript.createToast(msg);
        }
    }
Exemplo n.º 3
0
    /*
     * 101:1000
     */
    static public void changeDataWithStr(string reward)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("GameUtil_hotfix", "changeDataWithStr"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.GameUtil_hotfix", "changeDataWithStr", null, reward);
            return;
        }

        List <string> list1 = new List <string>();

        CommonUtil.splitStr(reward, list1, ';');

        for (int i = 0; i < list1.Count; i++)
        {
            List <string> list2 = new List <string>();
            CommonUtil.splitStr(list1[i], list2, ':');

            int id  = int.Parse(list2[0]);
            int num = int.Parse(list2[1]);

            changeData(id, num);
        }
    }
Exemplo n.º 4
0
    public void httpCallBack(string tag, string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PropData_hotfix", "httpCallBack"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PropData_hotfix", "httpCallBack", null, tag, data);
            return;
        }

        try
        {
            // 读取配置文件
            {
                init(data);
            }
        }
        catch (Exception ex)
        {
            LogUtil.Log("获取道具表文件出错:" + ex.Message);
            OtherData.s_getNetEntityFile.GetFileFail("prop.json");

            //throw ex;
        }
    }
    // Use this for initialization
    void Start()
    {
        OtherData.s_sign30LeiJiPanelScript = this;

        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Sign30LeiJiPanelScript_hotfix", "Start"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Sign30LeiJiPanelScript_hotfix", "Start", null, null);
            return;
        }

        if (Sign30Data.getInstance().getSign30DataContentList().Count == 0)
        {
            Debug.Log("签到奖励配置表未赋值");
            return;
        }

        Sign30DataContent temp = Sign30Data.getInstance().getSign30DataById(m_id);

        // 全勤奖
        if (temp.day == CommonUtil.getCurMonthAllDays())
        {
            m_text_title.text = ("累计签到" + CommonUtil.getCurMonthAllDays().ToString() + "天");
            gameObject.transform.Find("Image_bg/Text_quanqin_tip").localScale = new Vector3(1, 1, 1);
        }
        else
        {
            m_text_title.text = ("累计签到" + temp.day.ToString() + "天");
        }

        // 领取奖励按钮状态
        {
            int signAllDays = Sign30RecordData.getInstance().getSign30RecordList().Count;

            if (m_id == 35)
            {
                // 达成
                if (signAllDays == CommonUtil.getCurMonthAllDays())
                {
                    bool isGet = Sign30RecordData.getInstance().isLeiJiSignTheDay(m_id);

                    // 达成已领取
                    if (isGet)
                    {
                        CommonUtil.setButtonEnable(m_btn_lingqujiangli, false);
                        CommonUtil.setImageSprite(m_btn_lingqujiangli.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_yilingqu");
                        m_btn_lingqujiangli.transform.Find("Image").GetComponent <Image>().SetNativeSize();
                    }
                    // 达成未领取
                    else
                    {
                        CommonUtil.setButtonEnable(m_btn_lingqujiangli, true);
                    }
                }
                // 未达成
                else
                {
                    CommonUtil.setButtonEnable(m_btn_lingqujiangli, false);
                }
            }
            else
            {
                // 达成
                if (signAllDays >= Sign30Data.getInstance().getSign30DataContentList()[m_id - 1].day)
                {
                    bool isGet = Sign30RecordData.getInstance().isLeiJiSignTheDay(m_id);

                    // 达成已领取
                    if (isGet)
                    {
                        CommonUtil.setButtonEnable(m_btn_lingqujiangli, false);
                        CommonUtil.setImageSprite(m_btn_lingqujiangli.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_yilingqu");
                        m_btn_lingqujiangli.transform.Find("Image").GetComponent <Image>().SetNativeSize();
                    }
                    // 达成未领取
                    else
                    {
                        CommonUtil.setButtonEnable(m_btn_lingqujiangli, true);
                    }
                }
                // 未达成
                else
                {
                    CommonUtil.setButtonEnable(m_btn_lingqujiangli, false);
                }
            }
        }

        // 奖励
        {
            List <string> list1 = new List <string>();
            CommonUtil.splitStr(temp.reward_prop, list1, ';');

            for (int i = 0; i < list1.Count; i++)
            {
                List <string> list2 = new List <string>();
                CommonUtil.splitStr(list1[i], list2, ':');

                int prop_id  = int.Parse(list2[0]);
                int prop_num = int.Parse(list2[1]);

                GameObject obj = transform.Find("Image_bg/Reward_" + (i + 1).ToString()).gameObject;
                obj.transform.localScale = new Vector3(1, 1, 1);
                CommonUtil.setImageSprite(obj.transform.Find("Image").GetComponent <Image>(), GameUtil.getPropIconPath(prop_id));
                obj.transform.Find("Text").GetComponent <Text>().text = prop_num.ToString();

                obj.transform.localPosition = new Vector3(CommonUtil.getPosX(list1.Count, 130, i, 0), 0, 0);
            }
        }
    }
Exemplo n.º 6
0
    public void initPoker(int num, int pokerType)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PokerScript_hotfix", "initPoker"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PokerScript_hotfix", "initPoker", null, num, pokerType);
            return;
        }

        m_num       = num;
        m_pokerType = pokerType;

        switch (m_pokerType)
        {
        case (int)TLJCommon.Consts.PokerType.PokerType_FangKuai:
        {
            CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "red_" + m_num);
            CommonUtil.setImageSpriteByAssetBundle(m_image_small_icon, "poker.unity3d", "icon_fangkuai");
            CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_fangkuai");
        }
        break;

        case (int)TLJCommon.Consts.PokerType.PokerType_HeiTao:
        {
            CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "black_" + m_num);
            CommonUtil.setImageSpriteByAssetBundle(m_image_small_icon, "poker.unity3d", "icon_heitao");
            CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_heitao");
        }
        break;

        case (int)TLJCommon.Consts.PokerType.PokerType_HongTao:
        {
            CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "red_" + m_num);
            CommonUtil.setImageSpriteByAssetBundle(m_image_small_icon, "poker.unity3d", "icon_hongtao");
            CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_hongtao");
        }
        break;

        case (int)TLJCommon.Consts.PokerType.PokerType_MeiHua:
        {
            CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "black_" + m_num);
            CommonUtil.setImageSpriteByAssetBundle(m_image_small_icon, "poker.unity3d", "icon_meihua");
            CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_meihua");
        }
        break;

        case (int)TLJCommon.Consts.PokerType.PokerType_Wang:
        {
            if (num == 15)
            {
                CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "black_" + m_num);
                CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_xiaowang");
            }
            else if (num == 16)
            {
                CommonUtil.setImageSpriteByAssetBundle(m_image_num, "poker.unity3d", "red_" + m_num);
                CommonUtil.setImageSpriteByAssetBundle(m_image_big_icon, "poker.unity3d", "icon_dawang");
            }

            m_image_num.SetNativeSize();
            m_image_big_icon.SetNativeSize();

            m_image_small_icon.transform.localScale = new Vector3(0, 0, 0);
            m_image_big_icon.transform.localScale   = new Vector3(1, 1, 1);
        }
        break;
        }
    }
Exemplo n.º 7
0
    // 请求注册
    public void reqQuickRegister()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("LoginScript_hotfix", "reqQuickRegister"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.LoginScript_hotfix", "reqQuickRegister", null, null);
            return;
        }

        if ((m_inputAccount_register.text.CompareTo("") == 0) ||
            (m_inputSecondPassword_register.text.CompareTo("") == 0) ||
            (m_inputPassword_register.text.CompareTo("") == 0))
        {
            ToastScript.createToast("请输入账号密码");
            return;
        }

        if (m_inputSecondPassword_register.text.CompareTo(m_inputPassword_register.text) != 0)
        {
            ToastScript.createToast("密码不一致");
            return;
        }

        // 检测账号是否合格
        if (SensitiveWordUtil.IsSensitiveWord(m_inputAccount_register.text))
        {
            ToastScript.createToast("您的账号有敏感词");

            return;
        }

        if (m_inputAccount_register.text.Length > 10)
        {
            ToastScript.createToast("账号长度不可超过10个字符");

            return;
        }

        // 检测密码是否合格
        {
            for (int i = 0; i < m_inputPassword_register.text.Length; i++)
            {
                string str = m_inputPassword_register.text[i].ToString();
                if (((CommonUtil.charToAsc(str) >= 48) && (CommonUtil.charToAsc(str) <= 57) ||
                     ((CommonUtil.charToAsc(str) >= 65) && (CommonUtil.charToAsc(str) <= 90) ||
                      ((CommonUtil.charToAsc(str) >= 97) && (CommonUtil.charToAsc(str) <= 122)))))
                {
                }
                else
                {
                    ToastScript.createToast("密码格式不对");

                    return;
                }
            }

            if (m_inputPassword_register.text.Length < 6)
            {
                ToastScript.createToast("密码至少6位");
                return;
            }

            if (m_inputPassword_register.text.Length > 30)
            {
                ToastScript.createToast("密码不能超过30位");
                return;
            }
        }

        NetLoading.getInstance().Show();

        {
            JsonData data = new JsonData();

            data["tag"] = TLJCommon.Consts.Tag_QuickRegister;
//            string result = Regex.Replace(m_inputAccount_register.text, @"\p{Cs}", "");//屏蔽emoji
            data["account"]     = m_inputAccount_register.text;
            data["password"]    = CommonUtil.GetMD5(m_inputSecondPassword_register.text);
            data["channelname"] = PlatformHelper.GetChannelName();
            LoginServiceSocket.s_instance.sendMessage(data.ToJson());
        }
    }
Exemplo n.º 8
0
    public void setMailReaded(int email_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("EmailPanelScript_hotfix", "setMailReaded"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.EmailPanelScript_hotfix", "setMailReaded", null, email_id);
            return;
        }

        UserMailData.getInstance().setMailReaded(email_id);

        for (int i = 0; i < m_ListViewScript.getItemList().Count; i++)
        {
            if (m_ListViewScript.getItemList()[i].GetComponent <Mail_List_Item_Script>().getMailData().m_email_id == email_id)
            {
                m_ListViewScript.getItemList()[i].GetComponent <Mail_List_Item_Script>().m_redPoint.transform.localScale = new Vector3(0, 0, 0);
            }
        }

        // 判断是否启用:一键领取、一键删除
        {
            bool canUseOneKeyRead   = false;
            bool canUseOneKeyDelete = false;

            for (int i = 0; i < UserMailData.getInstance().getUserMailDataList().Count; i++)
            {
                if (UserMailData.getInstance().getUserMailDataList()[i].m_state == 0)
                {
                    canUseOneKeyRead = true;
                }

                if (UserMailData.getInstance().getUserMailDataList()[i].m_state == 1)
                {
                    canUseOneKeyDelete = true;
                }
            }

            if (canUseOneKeyRead && canUseOneKeyDelete)
            {
                m_button_oneKeyRead.transform.localScale   = new Vector3(1, 1, 1);
                m_button_oneKeyDelete.transform.localScale = new Vector3(1, 1, 1);

                m_button_oneKeyRead.transform.localPosition   = new Vector3(-130, -230.31f, 0);
                m_button_oneKeyDelete.transform.localPosition = new Vector3(130, -230.31f, 0);
            }
            else
            {
                if (canUseOneKeyRead)
                {
                    m_button_oneKeyRead.transform.localScale   = new Vector3(1, 1, 1);
                    m_button_oneKeyDelete.transform.localScale = new Vector3(0, 0, 0);

                    m_button_oneKeyRead.transform.localPosition = new Vector3(0, -230.31f, 0);
                }

                if (canUseOneKeyDelete)
                {
                    m_button_oneKeyDelete.transform.localScale = new Vector3(1, 1, 1);
                    m_button_oneKeyRead.transform.localScale   = new Vector3(0, 0, 0);

                    m_button_oneKeyDelete.transform.localPosition = new Vector3(0, -230.31f, 0);
                }
            }
        }
    }
    public void useProp(int id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PropDetailPanelScript_hotfix", "useProp"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PropDetailPanelScript_hotfix", "useProp", null, id);
            return;
        }

        switch (id)
        {
        // 记牌器
        case (int)TLJCommon.Consts.Prop.Prop_jipaiqi:
        {
            // 增加到buff数据里
            {
                bool isFind = false;
                for (int i = 0; i < UserData.buffData.Count; i++)
                {
                    if ((UserData.buffData[i].prop_id == (int)TLJCommon.Consts.Prop.Prop_jipaiqi))
                    {
                        isFind = true;
                        ++UserData.buffData[i].buff_num;
                        break;
                    }
                }

                if (!isFind)
                {
                    UserData.buffData.Add(new BuffData((int)TLJCommon.Consts.Prop.Prop_jipaiqi, 1));
                }
            }

            if (OtherData.s_gameScript != null)
            {
                OtherData.s_gameScript.useProp_jipaiqi();
            }
        }
        break;

        // 加倍卡
        case (int)TLJCommon.Consts.Prop.Prop_jiabeika:
        {
            // 不用处理
        }
        break;

        // 鸡蛋
        case (int)TLJCommon.Consts.Prop.Prop_jidan:
        {
            // 不用处理
        }
        break;

        // 鲜花
        case (int)TLJCommon.Consts.Prop.Prop_xianhua:
        {
            // 不用处理
        }
        break;

        // 出牌发光
        case (int)TLJCommon.Consts.Prop.Prop_chupaifaguang:
        {
            // 不用处理
        }
        break;

        // 喇叭
        case (int)TLJCommon.Consts.Prop.Prop_laba:
        {
        }
        break;

        // 蓝钻石
        case (int)TLJCommon.Consts.Prop.Prop_lanzuanshi:
        {
            // 不用处理
        }
        break;

        // 逃跑率清零卡
        case (int)TLJCommon.Consts.Prop.Prop_taopaolvqinglin:
        {
            UserData.gameData.runCount = 0;
        }
        break;

        // 魅力值修正卡
        case (int)TLJCommon.Consts.Prop.Prop_meilizhixiuzheng:
        {
            UserData.gameData.meiliZhi = 0;
        }
        break;

        // 徽章
        case (int)TLJCommon.Consts.Prop.Prop_huizhang:
        {
            // 不用处理
        }
        break;

        // 10元、20元京东卡
        case 130:
        case 131:
        {
            ToastScript.createToast("请去邮箱查看");
        }
        break;
        }
    }
    public void onCallBackOneKeyGetAllTuiGuangReward(string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TuiGuangYouLiPanelScript_hotfix", "onCallBackOneKeyGetAllTuiGuangReward"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TuiGuangYouLiPanelScript_hotfix", "onCallBackOneKeyGetAllTuiGuangReward", null, data);
            return;
        }

        NetLoading.getInstance().Close();

        JsonData jsonData = JsonMapper.ToObject(data);
        int      code     = (int)jsonData["code"];

        if (code == (int)TLJCommon.Consts.Code.Code_OK)
        {
            // 禁用一键领取按钮
            m_btn_yijianlingqu.interactable = false;

            string reward = (string)jsonData["reward"];

            if (reward.CompareTo("") != 0)
            {
                List <string> list = new List <string>();
                CommonUtil.splitStr(reward, list, ';');
                for (int i = 0; i < list.Count; i++)
                {
                    GameUtil.changeData(GameUtil.getPropIdFromReward(list[i]), GameUtil.getPropNumFromReward(list[i]));

                    ShowRewardPanelScript.Show(list[i], false);
                }

                for (int i = 0; i < MyTuiGuangData.getInstance().getMyTuiGuangDataList().Count; i++)
                {
                    MyTuiGuangDataContent temp = MyTuiGuangData.getInstance().getMyTuiGuangDataList()[i];

                    GameObject obj = null;
                    for (int j = 0; j < m_listview_player.getItemList().Count; j++)
                    {
                        if (m_listview_player.getItemList()[j].transform.name.CompareTo(temp.uid) == 0)
                        {
                            obj = m_listview_player.getItemList()[j];
                            break;
                        }
                    }

                    if (temp.task1_state == 2)
                    {
                        temp.task1_state = 3;

                        obj.transform.Find("Text_task1_state").GetComponent <Text>().text          = "";
                        obj.transform.Find("Text_task1_state/Image_yilingqu").transform.localScale = new Vector3(1, 1, 1);
                        CommonUtil.setFontColor(obj.transform.Find("Text_task1_state").GetComponent <Text>(), 99, 99, 99);
                    }

                    if (temp.task2_state == 2)
                    {
                        temp.task2_state = 3;

                        obj.transform.Find("Text_task2_state").GetComponent <Text>().text          = "";
                        obj.transform.Find("Text_task2_state/Image_yilingqu").transform.localScale = new Vector3(1, 1, 1);
                        CommonUtil.setFontColor(obj.transform.Find("Text_task2_state").GetComponent <Text>(), 99, 99, 99);
                    }
                }

                ToastScript.createToast("领取奖励成功");
            }
            else
            {
                ToastScript.createToast("当前没有奖励可领取");
            }
        }
        else
        {
            string msg = (string)jsonData["msg"];

            ToastScript.createToast(msg);
        }
    }
    public void onReceive_Sign30(string result)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Sign30PanelScript_hotfix", "onReceive_Sign30"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Sign30PanelScript_hotfix", "onReceive_Sign30", null, result);
            return;
        }

        NetLoading.getInstance().Close();

        JsonData jd = JsonMapper.ToObject(result);

        int code = (int)jd["code"];
        int type = (int)jd["type"];

        if (code == (int)TLJCommon.Consts.Code.Code_OK)
        {
            int    id          = (int)jd["id"];
            string reward_prop = (string)jd["reward_prop"];

            // 奖励加到内存
            {
                List <string> list1 = new List <string>();
                CommonUtil.splitStr(reward_prop, list1, ';');
                for (int i = 0; i < list1.Count; i++)
                {
                    List <string> list2 = new List <string>();
                    CommonUtil.splitStr(list1[i], list2, ':');

                    int prop_id  = int.Parse(list2[0]);
                    int prop_num = int.Parse(list2[1]);

                    GameUtil.changeData(prop_id, prop_num);
                }
            }

            ShowRewardPanelScript.Show(reward_prop, false);

            switch (type)
            {
            // 今天签到
            case 1:
            {
                ToastScript.createToast("签到成功");

                {
                    Sign30RecordData.getInstance().getSign30RecordList().Add(id);

                    m_text_lianxuqiandaotianshu.text = "累计签到天数:" + Sign30RecordData.getInstance().getSign30RecordList().Count.ToString() + "天";

                    GameObject obj = transform.Find("Image_bg/" + (id - 1).ToString()).gameObject;
                    obj.transform.Find("Image_yiqian").localScale = new Vector3(1, 1, 1);
                    obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                    //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                    //obj.transform.Find("Image_icon").localScale = new Vector3(0, 0, 0);

                    OtherData.s_mainScript.checkRedPoint();

                    setBtnSignState(Sign30Data.getInstance().getSign30DataById(id).day);
                    setLeiJiSignState();
                }
            }
            break;

            // 补签
            case 2:
            {
                ToastScript.createToast("补签成功");

                {
                    Sign30RecordData.getInstance().getSign30RecordList().Add(id);

                    m_text_lianxuqiandaotianshu.text = "累计签到天数:" + Sign30RecordData.getInstance().getSign30RecordList().Count.ToString() + "天";

                    GameObject obj = transform.Find("Image_bg/" + (id - 1).ToString()).gameObject;
                    obj.transform.Find("Image_yiqian").localScale = new Vector3(1, 1, 1);
                    obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);

                    //obj.transform.Find("Image_icon").localScale = new Vector3(0, 0, 0);
                }

                Destroy(OtherData.s_buQianQueRenPanelScript.gameObject);

                // 扣除补签费
                GameUtil.changeData(1, -OtherData.s_buQianQueRenPanelScript.getBuQianGoldHuaFei());

                // 增加补签次数
                ++Sign30RecordData.getInstance().m_curMonthBuQianCount;

                setBtnSignState(Sign30Data.getInstance().getSign30DataById(id).day);
                setLeiJiSignState();
            }
            break;

            // 累计签到奖励
            case 3:
            {
                Destroy(OtherData.s_sign30LeiJiPanelScript.gameObject);

                Sign30RecordData.getInstance().getSign30LeiJiRecordList().Add(id);
                setLeiJiSignState();

                ToastScript.createToast("领取奖励成功");
            }
            break;
            }
        }
        else
        {
            string msg = (string)jd["msg"];
            ToastScript.createToast(msg);
        }
    }
Exemplo n.º 12
0
    public static void GetPokerWhenTlj(List <PokerInfo> myPokerList, List <PokerInfo> masterPoker,
                                       List <PokerInfo> tempList, int count, int mLevelPokerNum, int masterPokerType)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetPokerWhenTlj"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetPokerWhenTlj", null, myPokerList, masterPoker, tempList, count, mLevelPokerNum, masterPokerType);
            return;
        }

        //从手牌中去除该类型的牌
        foreach (var poker in masterPoker)
        {
            myPokerList.Remove(poker);
        }

        if (masterPoker.Count <= count)
        {
            tempList.AddRange(masterPoker);
            //主牌不足会补副牌
            for (int j = 0; j < count - masterPoker.Count; j++)
            {
                tempList.Add(myPokerList[myPokerList.Count - 1 - j]);
            }
        }
        //主牌大于出牌的张数
        else
        {
            List <PokerInfo> doublePoker = GetDoublePoker(masterPoker);
            List <PokerInfo> singlePoker = GetSinglePoker(masterPoker, doublePoker);
            if (doublePoker.Count <= count)
            {
                tempList.AddRange(doublePoker);
                //对子不足会补牌
                for (int j = 0; j < count - doublePoker.Count; j++)
                {
                    tempList.Add(singlePoker[j]);
                }
            }
            //手牌中的对子多于出牌的对子
            else
            {
                List <List <PokerInfo> > allTljFromDouble =
                    GetAllTljFromDouble(doublePoker, mLevelPokerNum, masterPokerType);
                if (allTljFromDouble.Count == 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        tempList.Add(doublePoker[doublePoker.Count - 1 - i]);
                    }
                }
                else
                {
                    foreach (var tljList in allTljFromDouble)
                    {
                        if (tljList.Count >= count)
                        {
                            for (int i = 0; i < count; i++)
                            {
                                tempList.Add(tljList[i]);
                            }
                            return;
                        }
                    }

                    //拖拉机没有第一家的长
                    tempList.AddRange(allTljFromDouble[0]);
                    foreach (var poker in allTljFromDouble[0])
                    {
                        doublePoker.Remove(poker);
                    }
                    for (int j = 0; j < count - allTljFromDouble[0].Count; j++)
                    {
                        tempList.Add(doublePoker[j]);
                    }
                }
            }
        }
    }
Exemplo n.º 13
0
    public static void GetPokerWhenShuaiP(List <PokerInfo> firstPokerList, List <PokerInfo> masterPoker,
                                          List <PokerInfo> tempAll, int count, List <PokerInfo> tempList)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetPokerWhenShuaiP"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetPokerWhenShuaiP", null, firstPokerList, masterPoker, tempAll, count, tempList);
            return;
        }

        List <PokerInfo> firstDoublePoker = GetDoublePoker(firstPokerList);
        List <PokerInfo> firstSinglePoker = GetSinglePoker(firstPokerList, firstDoublePoker);

        //从手牌中去除该类型的牌
        foreach (var poker in masterPoker)
        {
            tempAll.Remove(poker);
        }

        if (masterPoker.Count <= count)
        {
            tempList.AddRange(masterPoker);
            //主牌不足会补副牌
            for (int j = 0; j < count - masterPoker.Count; j++)
            {
                tempList.Add(tempAll[tempAll.Count - 1 - j]);
            }
        }
        //主牌大于出牌的张数
        else
        {
            //得到主牌中的对子
            List <PokerInfo> myDoublePoker = GetDoublePoker(masterPoker);
            List <PokerInfo> mySinglePoker = GetSinglePoker(masterPoker, myDoublePoker);
            if (myDoublePoker.Count <= firstDoublePoker.Count)
            {
                tempList.AddRange(myDoublePoker);
                //对子不足会补牌
                for (int j = 0; j < count - myDoublePoker.Count; j++)
                {
                    tempList.Add(mySinglePoker[j]);
                }
            }
            //手牌中的对子多于出牌的对子
            else
            {
                for (int i = 0; i < firstDoublePoker.Count; i++)
                {
                    tempList.Add(myDoublePoker[i]);
                    //                    myDoublePoker.Remove(myDoublePoker[i]);
                }

                foreach (var Poker in tempList)
                {
                    myDoublePoker.Remove(Poker);
                }

                for (int i = 0; i < firstSinglePoker.Count; i++)
                {
                    if (mySinglePoker.Count == 0)
                    {
                        tempList.Add(myDoublePoker[i]);
                    }
                    else
                    {
                        tempList.Add(mySinglePoker[i]);
                    }
                }
            }
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// 托管的时候自动获取跟牌时要出的牌
    /// </summary>
    /// <param name="firstPokerList"></param>
    /// <param name="myPokerList"></param>
    /// <param name="mLevelPokerNum"></param>
    /// <param name="masterPokerType"></param>
    /// <returns></returns>
    public static List <PokerInfo> GetPokerWhenTuoGuan(List <PokerInfo> firstPokerList, List <PokerInfo> myPokerList,
                                                       int mLevelPokerNum, int masterPokerType)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetPokerWhenTuoGuan"))
        {
            List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetPokerWhenTuoGuan", null, firstPokerList, myPokerList, mLevelPokerNum, masterPokerType);
            return(list_temp);
        }

        List <PokerInfo> tempAll = new List <PokerInfo>();

        foreach (var poker in myPokerList)
        {
            tempAll.Add(poker);
        }
        //设置权重
        SetPokerWeight(firstPokerList, mLevelPokerNum, (Consts.PokerType)masterPokerType);
        SetPokerWeight(myPokerList, mLevelPokerNum, (Consts.PokerType)masterPokerType);

        List <PokerInfo> resultList = new List <PokerInfo>();
        //第一个人出牌的牌数
        int count = firstPokerList.Count;

        switch (CheckOutPoker.checkOutPokerType(firstPokerList, mLevelPokerNum,
                                                masterPokerType))
        {
        //第一个人是单牌
        case CheckOutPoker.OutPokerType.OutPokerType_Single:
            //第一个人出的是主牌
            if (PlayRuleUtil.IsMasterPoker(firstPokerList[0], mLevelPokerNum, masterPokerType))
            {
                List <PokerInfo> masterPoker =
                    PlayRuleUtil.GetMasterPoker(tempAll, mLevelPokerNum, masterPokerType);
                GetPokerWhenSingle(tempAll, masterPoker, resultList);
            }
            //出的是副牌
            else
            {
                //如果有该副牌花色必须出该花色
                List <PokerInfo> typeInfo;
                PlayRuleUtil.IsContainTypePoke(tempAll, mLevelPokerNum, firstPokerList[0].m_pokerType,
                                               out typeInfo);
                GetPokerWhenSingle(tempAll, typeInfo, resultList);
            }
            break;

        //第一个人是对子
        case CheckOutPoker.OutPokerType.OutPokerType_Double:
            //第一个人出的是主牌
            if (PlayRuleUtil.IsMasterPoker(firstPokerList[0], mLevelPokerNum, masterPokerType))
            {
                List <PokerInfo> masterPoker =
                    PlayRuleUtil.GetMasterPoker(tempAll, mLevelPokerNum, masterPokerType);
                GetPokerWhenDouble(tempAll, masterPoker, resultList);
            }
            //出的是副牌
            else
            {
                //如果有该副牌花色必须出该花色
                List <PokerInfo> typeInfo;
                PlayRuleUtil.IsContainTypePoke(tempAll, mLevelPokerNum, firstPokerList[0].m_pokerType,
                                               out typeInfo);
                GetPokerWhenDouble(tempAll, typeInfo, resultList);
            }
            break;

        //第一个人是拖拉机
        case CheckOutPoker.OutPokerType.OutPokerType_TuoLaJi:
            //第一个人出的是主牌
            if (PlayRuleUtil.IsMasterPoker(firstPokerList[0], mLevelPokerNum, masterPokerType))
            {
                List <PokerInfo> masterPoker =
                    PlayRuleUtil.GetMasterPoker(tempAll, mLevelPokerNum, masterPokerType);
                GetPokerWhenTlj(tempAll, masterPoker, resultList, count, mLevelPokerNum, masterPokerType);
            }
            //出的是副牌
            else
            {
                //如果有该副牌花色必须出该花色
                List <PokerInfo> typeInfo;
                PlayRuleUtil.IsContainTypePoke(tempAll, mLevelPokerNum, firstPokerList[0].m_pokerType,
                                               out typeInfo);
                GetPokerWhenTlj(tempAll, typeInfo, resultList, count, mLevelPokerNum, masterPokerType);
            }
            break;

        case CheckOutPoker.OutPokerType.OutPokerType_ShuaiPai:
            if (PlayRuleUtil.IsMasterPoker(firstPokerList[0], mLevelPokerNum, masterPokerType))
            {
                //第一个人出的是主牌
                List <PokerInfo> masterPoker = GetMasterPoker(tempAll, mLevelPokerNum, masterPokerType);
                GetPokerWhenShuaiP(firstPokerList, masterPoker, tempAll, count, resultList);
            }
            //甩的是副牌
            else
            {
                //如果有该副牌花色必须出该花色
                List <PokerInfo> typeInfo;
                PlayRuleUtil.IsContainTypePoke(tempAll, mLevelPokerNum, firstPokerList[0].m_pokerType,
                                               out typeInfo);
                GetPokerWhenShuaiP(firstPokerList, typeInfo, tempAll, count, resultList);
            }
            break;
        }

        if (firstPokerList.Count != resultList.Count)
        {
//            TLJ_PlayService.PlayService.log.Warn($"托管的出的牌的牌数不一致,托管出了{resultList.Count}张,第一个人出了{firstPokerList.Count}张");
        }
        return(resultList);
    }
Exemplo n.º 15
0
    //比较甩牌中的对子
    public static List <PokerInfo> CompareDoublePoker(List <PokerInfo> firestDoubleList,
                                                      List <PokerInfo> OtherDoubleleList,
                                                      int mLevelPokerNum, int mMasterPokerType, out List <List <PokerInfo> > OtherTlj)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "CompareDoublePoker"))
        {
            OtherTlj = new List <List <PokerInfo> >();
            List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "CompareDoublePoker", null, firestDoubleList, OtherDoubleleList, mLevelPokerNum, mMasterPokerType, OtherTlj);
            return(list_temp);
        }

        List <PokerInfo> list = new List <PokerInfo>();

        OtherTlj = new List <List <PokerInfo> >();
        //继续比较对子
        if (firestDoubleList.Count > 0)
        {
            if (OtherDoubleleList.Count > 0)
            {
                List <List <PokerInfo> > firstAllTlj =
                    GetAllTljFromDouble(firestDoubleList, mLevelPokerNum, mMasterPokerType);
                List <List <PokerInfo> > OtherAllTlj =
                    GetAllTljFromDouble(OtherDoubleleList, mLevelPokerNum, mMasterPokerType);
                //如果甩牌的对子中包括拖拉机,则和其他玩家手中的拖拉机比较
                if (firstAllTlj.Count > 0)
                {
                    if (OtherAllTlj.Count > 0)
                    {
                        OtherTlj = OtherAllTlj;
                        for (int j = 0; j < firstAllTlj.Count; j++)
                        {
                            List <PokerInfo> TljPoker = firstAllTlj[j];
                            for (int k = 0; k < OtherAllTlj.Count; k++)
                            {
                                var otherTljPoker = OtherAllTlj[k];
                                //第一个拖拉机的对子多于其他玩家手中的拖拉机
                                if (TljPoker.Count > otherTljPoker.Count)
                                {
                                }
                                else
                                {
                                    //第一个拖拉机最小对子大于其他玩家手中的拖拉机最大的
                                    if (TljPoker[0].m_weight >=
                                        otherTljPoker[otherTljPoker.Count - 1].m_weight)
                                    {
                                        //TLJ_PlayService.PlayService.log.Info("拖拉机大");
                                    }
                                    else
                                    {
                                        //TLJ_PlayService.PlayService.log.Info("拖拉机比别人小");
                                        list = TljPoker;
                                        return(list);
                                    }
                                }
                            }
                        }
                    }
                    //其他玩家手中没有拖拉机
                    else
                    {
                        //TLJ_PlayService.PlayService.log.Info("没有拖拉机");
                        //该玩家牌大,不作处理
                    }
                }
                //甩牌为多个不连续对子
                else
                {
                    if (OtherDoubleleList.Count > 0)
                    {
                        if (firestDoubleList[0].m_weight >= OtherDoubleleList[OtherDoubleleList.Count - 1].m_weight)
                        {
                            //该玩家牌大,不作处理
                        }
                        else
                        {
                            //甩牌失败,单牌大,但是对子比别人小
                            //TLJ_PlayService.PlayService.log.Info("甩牌失败,单牌大,但是对子比别人小");
                            list.Add(firestDoubleList[0]);
                            list.Add(firestDoubleList[1]);
                            return(list);
                        }
                    }
                    //没有对子
                    else
                    {
                    }
                }
            }
            //其他玩家没有对子,甩牌成功
            else
            {
                //该玩家牌大,不作处理
            }
        }
        return(list);
    }
    public void showTab(CurShowTab m_curShowTab)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TuiGuangYouLiPanelScript_hotfix", "showTab"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TuiGuangYouLiPanelScript_hotfix", "showTab", null, m_curShowTab);
            return;
        }

        switch (m_curShowTab)
        {
        case CurShowTab.CurShowTab_wodetuiguang:
        {
            GameUtil.showGameObject(m_tab_wodetuiguang);
            GameUtil.hideGameObject(m_tab_tuiguangguize);
            GameUtil.hideGameObject(m_tab_bulingjiangli);

            GameUtil.showGameObject(m_btn_yijianlingqu.gameObject);

            {
                CommonUtil.setImageSprite(m_btn_myTuiGuang.GetComponent <Image>(), "Sprites/Common/tab_xuanze");
                CommonUtil.setImageSprite(m_btn_tuigungguize.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");
                CommonUtil.setImageSprite(m_btn_bulingjiangli.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");

                m_btn_myTuiGuang.GetComponent <Image>().SetNativeSize();
                m_btn_tuigungguize.GetComponent <Image>().SetNativeSize();
                m_btn_bulingjiangli.GetComponent <Image>().SetNativeSize();

                CommonUtil.setImageSpriteByAssetBundle(m_btn_myTuiGuang.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "wdtg02");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_tuigungguize.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "tg01");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_bulingjiangli.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "bljl01");
            }

            loadMyTuiGuangData();
        }
        break;

        case CurShowTab.CurShowTab_tuiguangguize:
        {
            GameUtil.hideGameObject(m_tab_wodetuiguang);
            GameUtil.showGameObject(m_tab_tuiguangguize);
            GameUtil.hideGameObject(m_tab_bulingjiangli);

            GameUtil.hideGameObject(m_btn_yijianlingqu.gameObject);

            {
                CommonUtil.setImageSprite(m_btn_myTuiGuang.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");
                CommonUtil.setImageSprite(m_btn_tuigungguize.GetComponent <Image>(), "Sprites/Common/tab_xuanze");
                CommonUtil.setImageSprite(m_btn_bulingjiangli.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");

                m_btn_myTuiGuang.GetComponent <Image>().SetNativeSize();
                m_btn_tuigungguize.GetComponent <Image>().SetNativeSize();
                m_btn_bulingjiangli.GetComponent <Image>().SetNativeSize();

                CommonUtil.setImageSpriteByAssetBundle(m_btn_myTuiGuang.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "wdtg01");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_tuigungguize.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "tg02");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_bulingjiangli.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "bljl01");
            }
        }
        break;

        case CurShowTab.CurShowTab_bulingjiangli:
        {
            GameUtil.hideGameObject(m_tab_wodetuiguang);
            GameUtil.hideGameObject(m_tab_tuiguangguize);
            GameUtil.showGameObject(m_tab_bulingjiangli);

            GameUtil.hideGameObject(m_btn_yijianlingqu.gameObject);

            {
                CommonUtil.setImageSprite(m_btn_myTuiGuang.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");
                CommonUtil.setImageSprite(m_btn_tuigungguize.GetComponent <Image>(), "Sprites/Common/tab_weixuanze");
                CommonUtil.setImageSprite(m_btn_bulingjiangli.GetComponent <Image>(), "Sprites/Common/tab_xuanze");

                m_btn_myTuiGuang.GetComponent <Image>().SetNativeSize();
                m_btn_tuigungguize.GetComponent <Image>().SetNativeSize();
                m_btn_bulingjiangli.GetComponent <Image>().SetNativeSize();

                CommonUtil.setImageSpriteByAssetBundle(m_btn_myTuiGuang.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "wdtg01");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_tuigungguize.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "tg01");
                CommonUtil.setImageSpriteByAssetBundle(m_btn_bulingjiangli.transform.Find("Image").GetComponent <Image>(), "tuiguang.unity3d", "bljl02");
            }
        }
        break;
        }
    }
    public void loadMyTuiGuangData()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TuiGuangYouLiPanelScript_hotfix", "loadMyTuiGuangData"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TuiGuangYouLiPanelScript_hotfix", "loadMyTuiGuangData", null, null);
            return;
        }

        m_listview_player.clear();

        for (int i = 0; i < MyTuiGuangData.getInstance().getMyTuiGuangDataList().Count; i++)
        {
            MyTuiGuangDataContent temp = MyTuiGuangData.getInstance().getMyTuiGuangDataList()[i];

            GameObject pre = Resources.Load("Prefabs/UI/Item/Item_TuiJianPlayer") as GameObject;
            GameObject obj = Instantiate(pre);
            obj.transform.name = temp.uid;
            obj.transform.Find("Text_name").GetComponent <Text>().text = temp.name;

            // 任务1
            {
                if (temp.task1_state == 1)
                {
                    obj.transform.Find("Text_task1_state").GetComponent <Text>().text = "未完成";
                }
                else if (temp.task1_state == 2)
                {
                    obj.transform.Find("Text_task1_state").GetComponent <Text>().text = "可领取";
                    CommonUtil.setFontColor(obj.transform.Find("Text_task1_state").GetComponent <Text>(), 251, 75, 9);

                    // 启用一键领取按钮
                    m_btn_yijianlingqu.interactable = true;
                }
                // 已领取
                else if (temp.task1_state == 3)
                {
                    obj.transform.Find("Text_task1_state").GetComponent <Text>().text          = "";
                    obj.transform.Find("Text_task1_state/Image_yilingqu").transform.localScale = new Vector3(1, 1, 1);
                }
            }

            // 任务2
            {
                if (temp.task2_state == 1)
                {
                    obj.transform.Find("Text_task2_state").GetComponent <Text>().text = "未完成";
                }
                else if (temp.task2_state == 2)
                {
                    obj.transform.Find("Text_task2_state").GetComponent <Text>().text = "可领取";
                    CommonUtil.setFontColor(obj.transform.Find("Text_task2_state").GetComponent <Text>(), 251, 75, 9);

                    // 启用一键领取按钮
                    m_btn_yijianlingqu.interactable = true;
                }
                // 已领取
                else if (temp.task2_state == 3)
                {
                    obj.transform.Find("Text_task2_state").GetComponent <Text>().text          = "";
                    obj.transform.Find("Text_task2_state/Image_yilingqu").transform.localScale = new Vector3(1, 1, 1);
                }
            }

            m_listview_player.addItem(obj);
        }

        m_listview_player.addItemEnd();
    }
    public void initUI()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Sign30PanelScript_hotfix", "initUI"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Sign30PanelScript_hotfix", "initUI", null, null);
            return;
        }

        // 年月
        m_text_time.text = CommonUtil.getCurYear() + "年" + CommonUtil.getCurMonth() + "月";

        // 本月天数
        m_curMonthdays = CommonUtil.getCurMonthAllDays();

        // 显示当天签到奖励
        {
            int day = CommonUtil.getCurDay();

            for (int i = 0; i < Sign30Data.getInstance().getSign30DataContentList().Count; i++)
            {
                if (Sign30Data.getInstance().getSign30DataContentList()[i].type == 1)
                {
                    if (Sign30Data.getInstance().getSign30DataContentList()[i].day == day)
                    {
                        m_curChoiceId = Sign30Data.getInstance().getSign30DataContentList()[i].id;
                        showCurDayReward(Sign30Data.getInstance().getSign30DataContentList()[i].reward_prop);
                        break;
                    }
                }
            }
        }

        for (int i = 0; i < m_curMonthdays; i++)
        {
            GameObject pre = Resources.Load("Prefabs/UI/Item/Item_Sign30") as GameObject;
            GameObject obj = Instantiate(pre);
            obj.transform.name = i.ToString();
            obj.transform.SetParent(gameObject.transform.Find("Image_bg"));
            obj.transform.localScale = new Vector3(1, 1, 1);
            obj.GetComponent <Button>().onClick.AddListener(() => onClickItemDay(obj));

            {
                Vector2 vec2_firstPos = new Vector2(-394, 168);
                int     jiange        = 85;

                float x = vec2_firstPos.x + (i % 7) * jiange;
                float y = vec2_firstPos.y - (i / 7) * jiange;
                obj.transform.localPosition = new Vector3(x, y, 1);
            }

            // 奖励icon
            {
                int prop_id = GameUtil.getPropIdFromReward(Sign30Data.getInstance().getSign30DataContentList()[i].reward_prop);
                CommonUtil.setImageSprite(obj.transform.Find("Image_icon").GetComponent <Image>(), GameUtil.getPropIconPath(prop_id));
            }

            // 奖励数量
            obj.transform.Find("Text_rewardNum").GetComponent <Text>().text = GameUtil.getPropNumFromReward(Sign30Data.getInstance().getSign30DataContentList()[i].reward_prop).ToString();

            // 第几天
            obj.transform.Find("Text_day").GetComponent <Text>().text = (i + 1).ToString();

            // 当天的做一些其他处理
            if ((i + 1) == CommonUtil.getCurDay())
            {
                // 当天的方块专门设置一个颜色
                CommonUtil.setImageColor(obj.GetComponent <Image>(), 255, 253, 113);

                setBtnSignState(CommonUtil.getCurDay());
            }

            // 签到状态
            {
                for (int j = 0; j < Sign30Data.getInstance().getSign30DataContentList().Count; j++)
                {
                    int day = Sign30Data.getInstance().getSign30DataContentList()[j].day;

                    if (day == (i + 1))
                    {
                        bool isSigned = false;

                        for (int k = 0; k < Sign30RecordData.getInstance().getSign30RecordList().Count; k++)
                        {
                            // 已签
                            if (Sign30RecordData.getInstance().getSign30RecordList()[k] == day)
                            {
                                isSigned = true;

                                obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                                //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                                //obj.transform.Find("Image_icon").localScale = new Vector3(0, 0, 0);
                                break;
                            }
                        }

                        // 过去
                        if (day < CommonUtil.getCurDay())
                        {
                            if (!isSigned)
                            {
                                obj.transform.Find("Image_yiqian").localScale = new Vector3(0, 0, 0);

                                // 如果是今天没有签到的话,不显示补签
                                if (day == CommonUtil.getCurDay())
                                {
                                    obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                                    //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                                }
                            }
                        }
                        // 当天
                        else if (day == CommonUtil.getCurDay())
                        {
                            if (isSigned)
                            {
                                obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                                //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                            }
                            else
                            {
                                obj.transform.Find("Image_yiqian").localScale = new Vector3(0, 0, 0);
                                obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                                //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                            }
                        }
                        // 未来
                        else
                        {
                            obj.transform.Find("Image_yiqian").localScale = new Vector3(0, 0, 0);
                            obj.transform.Find("Image_buqian").localScale = new Vector3(0, 0, 0);
                            //obj.transform.Find("Image_yiguoqi").localScale = new Vector3(0, 0, 0);
                        }
                    }
                }
            }
        }

        // 累计签到奖励
        {
            for (int i = 1; i <= 3; i++)
            {
                Sign30DataContent data = Sign30Data.getInstance().getSign30DataById(31 + i);
                int prop_id            = GameUtil.getPropIdFromReward(data.reward_prop);
                int prop_num           = GameUtil.getPropNumFromReward(data.reward_prop);

                GameObject parent = transform.Find("Image_bg/Image_leiji_" + i.ToString()).gameObject;

                // 天数
                parent.transform.Find("Text_day").GetComponent <Text>().text = data.day.ToString() + "天";

                // 奖励icon
                CommonUtil.setImageSprite(parent.transform.Find("Image_rewardIcon").GetComponent <Image>(), GameUtil.getPropIconPath(prop_id));

                // 奖励数量
                parent.transform.Find("Text_rewardNum").GetComponent <Text>().text = "*" + prop_num.ToString();
            }
        }

        // 累计签到天数显示
        m_text_lianxuqiandaotianshu.text = "累计签到天数:" + Sign30RecordData.getInstance().getSign30RecordList().Count.ToString() + "天";

        // 累计签到奖励
        setLeiJiSignState();
    }
Exemplo n.º 19
0
    public void InitUI()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("UserInfoScript_hotfix", "InitUI"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.UserInfoScript_hotfix", "InitUI", null, null);
            return;
        }

        nickName.text     = UserData.name;
        account.text      = UserData.uid;
        gold.text         = UserData.gold.ToString();
        yuanBaoCount.text = UserData.yuanbao.ToString();
        meiLiZhi.text     = UserData.gameData.meiliZhi + "";
        int vipLevel = VipUtil.GetVipLevel(UserData.rechargeVip);

        CommonUtil.setImageSpriteByAssetBundle(Vip, "vip.unity3d", "user_vip_" + vipLevel);
        if (UserData.IsRealName)
        {
            ButtonRealName.interactable         = false;
            ButtonRealName.transform.localScale = Vector3.zero;
            AlReadyRN.transform.localScale      = Vector3.one;
        }
        else
        {
            ButtonRealName.interactable         = true;
            ButtonRealName.transform.localScale = Vector3.one;
            AlReadyRN.transform.localScale      = Vector3.zero;
        }

        if (string.IsNullOrEmpty(UserData.phone))
        {
            ButtonBindPhone.interactable           = true;
            ButtonBindPhone.transform.localScale   = Vector3.one;
            ButtonChangePhone.transform.localScale = Vector3.zero;
        }
        else
        {
            ButtonBindPhone.interactable           = false;
            ButtonBindPhone.transform.localScale   = Vector3.zero;
            ButtonChangePhone.transform.localScale = Vector3.one;
        }


        headIcon.GetComponent <HeadIconScript>().setIcon(UserData.head);

        if (UserData.gameData.allGameCount == 0)
        {
            shengLv.text  = "0%";
            allGame.text  = "0";
            taoPaoLv.text = "0%";
        }
        else
        {
            //默认为保留两位
            shengLv.text  = String.Format("{0:F}", (UserData.gameData.winCount / (float)UserData.gameData.allGameCount) * 100) + "%";
            allGame.text  = UserData.gameData.allGameCount + "";
            taoPaoLv.text = String.Format("{0:F}", (UserData.gameData.runCount / (float)UserData.gameData.allGameCount) * 100) + "%";;
        }

        headIcon.GetComponent <HeadIconScript>().setIcon(UserData.head);
    }
    public void setBtnSignState(int day)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Sign30PanelScript_hotfix", "setBtnSignState"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Sign30PanelScript_hotfix", "setBtnSignState", null, day);
            return;
        }

        // 未来
        if (day > CommonUtil.getCurDay())
        {
            CommonUtil.setButtonEnable(m_btn_sign, false);
            CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_qiandao");
        }
        // 当天
        else if (day == CommonUtil.getCurDay())
        {
            bool isSign = false;
            for (int i = 0; i < Sign30RecordData.getInstance().getSign30RecordList().Count; i++)
            {
                if (Sign30RecordData.getInstance().getSign30RecordList()[i] == day)
                {
                    isSign = true;

                    break;
                }
            }

            // 已签
            if (isSign)
            {
                CommonUtil.setButtonEnable(m_btn_sign, false);
                CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_qiandao");
            }
            // 未签
            else
            {
                CommonUtil.setButtonEnable(m_btn_sign, true);
                CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_qiandao");
            }
        }
        // 过去
        else
        {
            bool isSign = false;
            for (int i = 0; i < Sign30RecordData.getInstance().getSign30RecordList().Count; i++)
            {
                if (Sign30RecordData.getInstance().getSign30RecordList()[i] == day)
                {
                    isSign = true;

                    break;
                }
            }

            // 已签
            if (isSign)
            {
                CommonUtil.setButtonEnable(m_btn_sign, false);
                CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_qiandao");
            }
            // 补签
            else
            {
                CommonUtil.setButtonEnable(m_btn_sign, false);
                CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_qiandao");

                CommonUtil.setButtonEnable(m_btn_sign, true);
                CommonUtil.setImageSprite(m_btn_sign.transform.Find("Image").GetComponent <Image>(), "Sprites/Sign30/wz_buqian");
            }
        }
    }
    public void setPropId(int prop_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PropDetailPanelScript_hotfix", "setPropId"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PropDetailPanelScript_hotfix", "setPropId", null, prop_id);
            return;
        }

        m_propInfo = PropData.getInstance().getPropInfoById(prop_id);

        if (m_propInfo != null)
        {
            m_text_name.text = m_propInfo.m_name;
            m_text_desc.text = m_propInfo.m_desc;
            CommonUtil.setImageSprite(m_image_icon, GameUtil.getPropIconPath(m_propInfo.m_id));

            if (m_propInfo.m_type != 0)
            {
                m_button_use.transform.localScale = new Vector3(0, 0, 0);
            }

            // 一元话费:显示数量调节对象
            if (m_propInfo.m_id == (int)TLJCommon.Consts.Prop.Prop_1yuanhuafei)
            {
                int myHuaFei_1 = GameUtil.getMyPropNumById((int)TLJCommon.Consts.Prop.Prop_1yuanhuafei);
                if (myHuaFei_1 >= 10)
                {
                    GameUtil.showGameObject(m_changeNum);
                    m_useNum = 10;

                    m_changeNum.transform.Find("Button_jia").GetComponent <Button>().interactable = false;
                }
                else if (myHuaFei_1 >= 5)
                {
                    GameUtil.showGameObject(m_changeNum);
                    m_useNum = 5;

                    m_changeNum.transform.Find("Button_jia").GetComponent <Button>().interactable = false;
                }

                m_changeNum.transform.Find("Text_num").GetComponent <Text>().text = m_useNum.ToString();
            }

            if ((m_propInfo.m_id == 111) ||
                (m_propInfo.m_id == 112) ||
                (m_propInfo.m_id == 113))
            {
                GameObject obj  = new GameObject();
                Text       text = obj.AddComponent <Text>();
                text.text     = "完成一次对局方可使用";
                text.fontSize = 20;
                CommonUtil.setFontColor(text, 0, 0, 0);
                text.font = transform.Find("Image_bg/Text_desc").GetComponent <Text>().font;
                text.GetComponent <RectTransform>().sizeDelta = new Vector2(250, 30);

                obj.transform.SetParent(transform.Find("Image_bg"));
                obj.transform.localPosition = new Vector3(26, 30, 0);
                obj.transform.localScale    = new Vector3(1, 1, 1);
            }
        }
    }
    public static GameObject getActivityPanel(Activity.ActivityData activity)
    {
        // 使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("ActivityManager_hotfix", "getActivityPanel"))
        {
            s_panel = (GameObject)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.ActivityManager_hotfix", "getActivityPanel", null, activity);
            return(s_panel);
        }

        if (s_panel != null)
        {
            GameObject.Destroy(s_panel);
        }

        int    activity_id = activity.ActivityId;
        string url         = activity.ImageUrl;

        switch (activity_id)
        {
        // 大礼来袭
        case 1:
        {
            setPanel_dalilaixi(url);
        }
        break;

        // 限时话费赛
        case 2:
        {
            setPanel_xianshihuafeisai(url);
        }
        break;

        // 老用户特权
        case 3:
        {
            setPanel_laoyonghutequan(url);
        }
        break;

        // 话费碎片
        case 4:
        {
            setPanel_huafeisuipian(url);
        }
        break;

        // 微信公众号
        case 5:
        {
            setPanel_weixingongzhonghao(url);
        }
        break;

        // 五一活动
        case 6:
        {
            setPanel_51(url);
        }
        break;

        default:
        {
            setPanel_other(activity);
        }
        break;
        }

        return(s_panel);
    }
Exemplo n.º 23
0
    public void loadMail()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("EmailPanelScript_hotfix", "loadMail"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.EmailPanelScript_hotfix", "loadMail", null, null);
            return;
        }

        m_ListViewScript.clear();

        for (int i = 0; i < UserMailData.getInstance().getUserMailDataList().Count; i++)
        {
            GameObject prefab = Resources.Load("Prefabs/UI/Item/Mail_List_Item") as GameObject;
            GameObject obj    = MonoBehaviour.Instantiate(prefab);
            obj.GetComponent <Mail_List_Item_Script>().m_parentScript = this;
            obj.GetComponent <Mail_List_Item_Script>().setMailData(UserMailData.getInstance().getUserMailDataList()[i]);

            obj.transform.name = UserMailData.getInstance().getUserMailDataList()[i].m_email_id.ToString();

            m_ListViewScript.addItem(obj);
        }

        m_ListViewScript.addItemEnd();

        // 判断是否启用:一键领取、一键删除
        {
            bool canUseOneKeyRead   = false;
            bool canUseOneKeyDelete = false;

            if (m_button_oneKeyRead != null)
            {
                m_button_oneKeyRead.transform.localScale   = new Vector3(0, 0, 0);
                m_button_oneKeyDelete.transform.localScale = new Vector3(0, 0, 0);
            }

            for (int i = 0; i < UserMailData.getInstance().getUserMailDataList().Count; i++)
            {
                if (UserMailData.getInstance().getUserMailDataList()[i].m_state == 0)
                {
                    canUseOneKeyRead = true;
                }

                if (UserMailData.getInstance().getUserMailDataList()[i].m_state == 1)
                {
                    canUseOneKeyDelete = true;
                }
            }

            if (canUseOneKeyRead && canUseOneKeyDelete)
            {
                m_button_oneKeyRead.transform.localScale   = new Vector3(1, 1, 1);
                m_button_oneKeyDelete.transform.localScale = new Vector3(1, 1, 1);

                m_button_oneKeyRead.transform.localPosition   = new Vector3(-130, -230.31f, 0);
                m_button_oneKeyDelete.transform.localPosition = new Vector3(130, -230.31f, 0);
            }
            else
            {
                if (canUseOneKeyRead)
                {
                    m_button_oneKeyRead.transform.localScale   = new Vector3(1, 1, 1);
                    m_button_oneKeyDelete.transform.localScale = new Vector3(0, 0, 0);

                    m_button_oneKeyRead.transform.localPosition = new Vector3(0, -230.31f, 0);
                }

                if (canUseOneKeyDelete)
                {
                    m_button_oneKeyDelete.transform.localScale = new Vector3(1, 1, 1);
                    m_button_oneKeyRead.transform.localScale   = new Vector3(0, 0, 0);

                    m_button_oneKeyDelete.transform.localPosition = new Vector3(0, -230.31f, 0);
                }
            }
        }

        m_text_mailNum.text = UserMailData.getInstance().getUserMailDataList().Count + "/50";

        //暂无邮件
        m_text_zanwu.transform.localScale = UserMailData.getInstance().getUserMailDataList().Count == 0 ? Vector3.one : Vector3.zero;
    }
Exemplo n.º 24
0
    public void Init(GameObject gameObject, Consts.PokerType pokerType)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "Init"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "Init", null, gameObject, pokerType);
            return;
        }

        //初始化数据

        List <PokerInfo>  heiTaoPokers = new List <PokerInfo>();
        List <GameObject> PokerItems   = new List <GameObject>();

        for (int i = 0; i < 2; i++)
        {
            for (int j = 2; j < 15; j++)
            {
                heiTaoPokers.Add(new PokerInfo(j, pokerType));
            }
        }
        heiTaoPokers = heiTaoPokers.OrderByDescending(a => a.m_num).ToList();
        if (!dicPokerData.ContainsKey(pokerType))
        {
            dicPokerData.Add(pokerType, heiTaoPokers);
        }

        //初始化UI
        for (int i = 0; i < heiTaoPokers.Count; i++)
        {
            PokerInfo poker = heiTaoPokers[i];

            GameObject go      = GameObject.Instantiate(ItemPoker, gameObject.transform);
            var        btn     = go.AddComponent <Button>();
            var        image   = go.GetComponent <Image>();
            bool       isClick = false;
            btn.onClick.AddListener(() =>
            {
                if (!isClick)
                {
                    image.color = Color.gray;
                    selectedPokers.Add(poker);
                    isClick   = true;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
                else
                {
                    image.color = Color.white;
                    selectedPokers.Remove(poker);
                    isClick   = false;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
            });

            PokerItems.Add(go);
            string temp = null;
            switch (pokerType)
            {
            case Consts.PokerType.PokerType_FangKuai:
                temp = "icon_fangkuai";
                break;

            case Consts.PokerType.PokerType_HeiTao:
                temp = "icon_heitao";
                break;

            case Consts.PokerType.PokerType_HongTao:
                temp = "icon_hongtao";
                break;

            case Consts.PokerType.PokerType_MeiHua:
                temp = "icon_meihua";
                break;
            }
            CommonUtil.setImageSpriteByAssetBundle(go.transform.Find("Type").GetComponent <Image>(), "poker.unity3d", temp);
            int num = poker.m_num;
            if (num >= 2 && num <= 10)
            {
                go.GetComponentInChildren <Text>().text = num.ToString();
            }
            else
            {
                if (num == 11)
                {
                    go.GetComponentInChildren <Text>().text = "J";
                }
                else if (num == 12)
                {
                    go.GetComponentInChildren <Text>().text = "Q";
                }
                else if (num == 13)
                {
                    go.GetComponentInChildren <Text>().text = "K";
                }
                else if (num == 14)
                {
                    go.GetComponentInChildren <Text>().text = "A";
                }
            }
        }
        if (!dictionaryGo.ContainsKey(pokerType))
        {
            dictionaryGo.Add(pokerType, PokerItems);
        }
    }
Exemplo n.º 25
0
    public void Set3rdLogin()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("LoginScript_hotfix", "Set3rdLogin"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.LoginScript_hotfix", "Set3rdLogin", null, null);
            return;
        }

        bool   is3RdLogin     = ChannelHelper.Is3RdLogin();
        string channelAllName = ChannelHelper.GetChannelAllName();

        LogUtil.Log("渠道号:" + OtherData.s_channelName + ",渠道名:" + channelAllName);

        bool isThirdLogin = PlatformHelper.IsThirdLogin();

        //应用宝渠道
        if ("yyb".Equals(OtherData.s_channelName))
        {
            GameUtil.hideGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
            m_button_guanfang.gameObject.SetActive(false);
            GameUtil.showGameObject(m_button_qq.gameObject);
            GameUtil.showGameObject(m_button_wechat.gameObject);

            Vector3 qqV3 = m_button_qq.gameObject.transform.localPosition;
            m_button_qq.gameObject.transform.localPosition = new Vector3(-168, qqV3.y, qqV3.z);

            Vector3 wxV3 = m_button_wechat.gameObject.transform.localPosition;
            m_button_wechat.gameObject.transform.localPosition = new Vector3(132, wxV3.y, wxV3.z);
            return;
        }

        if (is3RdLogin && isThirdLogin)
        {
            m_button_3rdLogin.gameObject.SetActive(true);
            GameUtil.showGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
            GameUtil.hideGameObject(m_button_guanfang.gameObject);
            GameUtil.hideGameObject(m_button_qq.gameObject);
            GameUtil.hideGameObject(m_button_wechat.gameObject);

            var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent <Text>();
            childText.text = channelAllName + "账号登录";

            m_button_3rdLogin.onClick.AddListener(() =>
            {
                AudioScript.getAudioScript().playSound_ButtonClick();
                PlatformHelper.Login("AndroidCallBack", "GetLoginResult", OtherData.s_channelName);
                NetLoading.getInstance().Show();
            });
        }
        else
        {
            GameUtil.showGameObject(m_button_guanfang.gameObject);
            GameUtil.showGameObject(m_button_qq.gameObject);
            GameUtil.showGameObject(m_button_wechat.gameObject);
            GameUtil.hideGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
        }

        //bool is3RdLogin = ChannelHelper.Is3RdLogin();
        //string channelAllName = ChannelHelper.GetChannelAllName();
        //LogUtil.Log("渠道号:" + OtherData.s_channelName + ",渠道名:"+ channelAllName);

        //bool isThirdLogin = PlatformHelper.IsThirdLogin();

        //if (is3RdLogin)
        //{
        //    if (isThirdLogin)
        //    {
        //        m_button_3rdLogin.gameObject.SetActive(true);
        //        m_button_defaultLogin.gameObject.SetActive(false);
        //        m_button_guanfang.gameObject.SetActive(false);
        //        m_button_qq.gameObject.SetActive(false);
        //        m_button_wechat.gameObject.SetActive(false);
        //        var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent<Text>();
        //        childText.text = channelAllName + "账号登录";
        //    }
        //}
        //else
        //{
        //    m_button_3rdLogin.gameObject.SetActive(false);
        //    m_button_defaultLogin.gameObject.SetActive(true);
        //    m_button_guanfang.gameObject.SetActive(true);
        //    m_button_qq.gameObject.SetActive(true);
        //    m_button_wechat.gameObject.SetActive(true);
        //    var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent<Text>();
        //    childText.text = channelAllName + "账号登录";
        //}

        //m_button_3rdLogin.onClick.AddListener(() =>
        //{
        //    AudioScript.getAudioScript().playSound_ButtonClick();
        //    PlatformHelper.Login("AndroidCallBack", "GetLoginResult", OtherData.s_channelName);
        //    NetLoading.getInstance().Show();
        //});
    }
Exemplo n.º 26
0
    public void UpdateUi(List <PokerInfo> list)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "UpdateUi"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "UpdateUi", null, list);
            return;
        }

        for (int i = 0; i < list.Count; i++)
        {
            PokerInfo pokerInfo = list[i];
            //大小王
            if (pokerInfo.m_num == 15)
            {
                if (xiaoWangList.Count == 2 || xiaoWangList.Count == 1)
                {
                    xiaoWangList[0].color = Color.gray;
                    xiaoWangList.Remove(xiaoWangList[0]);
                }
            }
            else if (pokerInfo.m_num == 16)
            {
                if (daWangList.Count == 2 || daWangList.Count == 1)
                {
                    daWangList[0].color = Color.gray;
                    daWangList.Remove(daWangList[0]);
                }
            }
            else if (pokerInfo.m_num < 15 && pokerInfo.m_num >= 2)
            {
                Consts.PokerType Type = pokerInfo.m_pokerType;

                List <PokerInfo> listPoker;
                dicPokerData.TryGetValue(Type, out listPoker);

                List <GameObject> listGo;
                dictionaryGo.TryGetValue(Type, out listGo);

                int index = -1;
                if (listPoker != null)
                {
                    for (int j = 0; j < listPoker.Count; j++)
                    {
                        var item = listPoker[j];
                        if (pokerInfo.m_num == item.m_num && pokerInfo.m_pokerType == item.m_pokerType)
                        {
                            index = listPoker.IndexOf(item);
                            listPoker.Remove(item);
                            break;
                        }
                    }
                }
                if (index == -1)
                {
                    return;
                }
                try
                {
                    if (listGo != null)
                    {
                        GameObject go = listGo[index];
                        go.GetComponent <Image>().color = Color.gray;
                        listGo.Remove(go);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            else
            {
                throw new Exception("牌的num异常");
            }
        }
    }
    public void onReceive_BuyGoods(string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("MedalDuiHuanQueRenPanelScript_hotfix", "onReceive_BuyGoods"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.MedalDuiHuanQueRenPanelScript_hotfix", "onReceive_BuyGoods", null, data);
            return;
        }

        NetLoading.getInstance().Close();

        JsonData jd   = JsonMapper.ToObject(data);
        int      code = (int)jd["code"];

        if (code == (int)TLJCommon.Consts.Code.Code_OK)
        {
            ToastScript.createToast("兑换成功");

            string reward = (string)jd["reward"];

            // 扣除徽章
            {
                int totalPrice = m_medalDuiHuanRewardData.price * m_goods_num;
                GameUtil.changeData(110, -totalPrice);

                OtherData.s_medalDuiHuanPanelScript.m_text_myMedalNum.text = UserData.medal.ToString();
            }

            // 奖励加到内存
            {
                List <string> list1 = new List <string>();
                CommonUtil.splitStr(reward, list1, ';');
                for (int i = 0; i < list1.Count; i++)
                {
                    List <string> list2 = new List <string>();
                    CommonUtil.splitStr(list1[i], list2, ':');

                    int prop_id  = int.Parse(list2[0]);
                    int prop_num = int.Parse(list2[1]);

                    GameUtil.changeData(prop_id, prop_num);
                }
            }

            // 增加兑换记录
            {
                MedalDuiHuanRecordDataContent temp = new MedalDuiHuanRecordDataContent();
                temp.goods_id = m_medalDuiHuanRewardData.goods_id;
                temp.num      = m_goods_num;

                string year  = CommonUtil.getCurYear().ToString();
                string month = CommonUtil.getCurMonth().ToString();
                if (month.Length == 1)
                {
                    month = ("0" + month);
                }

                string day = CommonUtil.getCurDay().ToString();
                if (day.Length == 1)
                {
                    day = ("0" + day);
                }
                temp.time = year + "年" + month + "月" + day + "日";
                MedalDuiHuanRecordData.getInstance().getDataList().Insert(0, temp);
            }

            for (int i = 0; i < m_goods_num; i++)
            {
                ShowRewardPanelScript.Show(reward, false);
            }

            Destroy(gameObject);
        }
        else
        {
            string msg = (string)jd["msg"];
            ToastScript.createToast(msg);
        }
    }
Exemplo n.º 28
0
    public void InitFirst()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "InitFirst"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "InitFirst", null, null);
            return;
        }

        Init(HeiTaoContent, Consts.PokerType.PokerType_HeiTao);
        Init(HongContent, Consts.PokerType.PokerType_HongTao);
        Init(MeiContent, Consts.PokerType.PokerType_MeiHua);
        Init(FangContent, Consts.PokerType.PokerType_FangKuai);

        xiaoWangList.Add(xiaoWang1);
        xiaoWangList.Add(xiaoWang2);
        daWangList.Add(daWang1);
        daWangList.Add(daWang2);
        var xiaopokerInfo = new PokerInfo(15, Consts.PokerType.PokerType_Wang);
        var dapokerInfo   = new PokerInfo(16, Consts.PokerType.PokerType_Wang);

        for (int i = 0; i < xiaoWangList.Count; i++)
        {
            var  xiaoWang = xiaoWangList[i];
            var  dawang   = daWangList[i];
            var  btn      = xiaoWang.gameObject.AddComponent <Button>();
            var  image    = xiaoWang.GetComponent <Image>();
            bool isClick  = false;
            btn.onClick.AddListener(() =>
            {
                if (!isClick)
                {
                    image.color = Color.gray;
                    selectedPokers.Add(xiaopokerInfo);
                    isClick   = true;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
                else
                {
                    image.color = Color.white;
                    selectedPokers.Remove(xiaopokerInfo);
                    isClick   = false;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
            });

            var  btn1     = dawang.gameObject.AddComponent <Button>();
            var  image1   = dawang.GetComponent <Image>();
            bool isClick1 = false;
            btn1.onClick.AddListener(() =>
            {
                if (!isClick1)
                {
                    image1.color = Color.gray;
                    selectedPokers.Add(dapokerInfo);
                    isClick1  = true;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
                else
                {
                    image1.color = Color.white;
                    selectedPokers.Remove(dapokerInfo);
                    isClick1  = false;
                    text.text = "当前选择:" + selectedPokers.Count + "张";
                }
            });
        }

        this.transform.localPosition = new Vector3(0, 0, 0);
        startPosition = this.transform.localPosition;
    }
    public void onInitializeItem(GameObject go, int dataindex)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("ShopPanelScript_hotfix", "onInitializeItem"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.ShopPanelScript_hotfix", "onInitializeItem", null, go, dataindex);
            return;
        }

        ShopData shopItemData = _shopItemDatas[dataindex];

        string[] strings = shopItemData.props.Split(':');
        int      id      = Convert.ToInt32(strings[0]);

        Image      goods_image     = go.transform.Find("goods_image").GetComponent <Image>();
        Text       goods_des       = go.transform.Find("goods_des").GetComponent <Text>();
        GameObject goods_bg        = go.transform.Find("goods_bg").gameObject;
        var        Image_price_bg  = goods_bg.transform.GetChild(0);
        var        Image_price_bg1 = goods_bg.transform.GetChild(1);
        var        goods_icon      = Image_price_bg.transform.GetChild(0).GetComponent <Image>();
        var        Text_Price      = Image_price_bg.transform.GetChild(1).GetComponent <Text>();
        var        goods_icon1     = Image_price_bg1.transform.GetChild(0).GetComponent <Image>();
        var        Text_Price1     = Image_price_bg1.transform.GetChild(1).GetComponent <Text>();

        //首充
        Image      Image_first_recharge = go.transform.Find("Image_first_recharge").GetComponent <Image>();
        GameObject Image_jiazeng        = go.transform.Find("Image_jiazeng").gameObject;

        goods_des.text = shopItemData.goods_name;

        if (_type == 3)
        {
            for (int i = 0; i < PropData.getInstance().getPropInfoList().Count; i++)
            {
                PropInfo propInfo = PropData.getInstance().getPropInfoList()[i];
                if (id == propInfo.m_id)
                {
                    goods_image.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/" + propInfo.m_icon);
                }
            }
        }
        else if (_type == 2)
        {
            goods_image.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_yuanbao");
            if (!string.IsNullOrEmpty(shopItemData.extra_reward))
            {
                Image_first_recharge.gameObject.SetActive(true);
                Image_jiazeng.gameObject.SetActive(true);

                Image_jiazeng.transform.GetChild(0).GetComponent <Text>().text = shopItemData.extra_reward.Split(':')[1] + "元宝";
            }
        }
        else
        {
            goods_image.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_jinbi");
        }

        //设置已经首充
        for (int i = 0; i < UserData.userRecharge.Count; i++)
        {
            if (UserData.userRecharge[i].goods_id == shopItemData.goods_id)
            {
                Image_first_recharge.gameObject.SetActive(false);
                Image_jiazeng.gameObject.SetActive(false);
            }
        }

        //设置第一个价格
        if (_shopItemDatas[dataindex].money_type == 1)
        {
            goods_icon.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_jinbi");
        }
        else if (_shopItemDatas[dataindex].money_type == 2)
        {
            goods_icon.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_yuanbao");
        }
        else
        {
            goods_icon.sprite = Resources.Load <Sprite>("Sprites/Icon/icon_rmb_white");
        }
        Text_Price.text = shopItemData.price + "";
        //设置第二个价格
        if (shopItemData.price2 > 0)
        {
            Image_price_bg1.gameObject.SetActive(true);
            goods_icon1.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_huizhang");

            Text_Price1.text = shopItemData.price2 + "";
        }
        else
        {
            Image_price_bg1.gameObject.SetActive(false);
        }


        Button button = go.GetComponent <Button>();

        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(delegate() { BuyGoodsPanelScript.create(_shopItemDatas[dataindex].goods_id); });
    }
    public void InitUI()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("RankListJifenScript_hotfix", "InitUI"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.RankListJifenScript_hotfix", "InitUI", null, null);
            return;
        }

        RectTransform ContentRect       = Content.GetComponent <RectTransform>();
        RectTransform ItemRect          = Item.GetComponent <RectTransform>();
        Vector2       itemRectSizeDelta = ItemRect.sizeDelta;

        //自己是否上榜
        for (int i = 0; i < _GoldRankList.Count; i++)
        {
            if (_GoldRankList[i].name.Equals(UserData.name))
            {
                myGoldRank = i + 1 + "";
            }
        }

        float f;

        if (string.IsNullOrEmpty(myGoldRank))
        {
            f = itemRectSizeDelta.y * _GoldRankList.Count;
        }
        else
        {
            LogUtil.Log("----1");
            f = itemRectSizeDelta.y * (_GoldRankList.Count - 1);
        }
        ContentRect.sizeDelta = new Vector2(0, f);


        for (int i = 0; i < _GoldRankList.Count; i++)
        {
            GoldRankItemData goldRankItemData = _GoldRankList[i];

            if (goldRankItemData.name.Equals(UserData.name))
            {
                continue;
            }

            GameObject goChild = GameObject.Instantiate(Item, Content.transform);

            if (goldRankItemData.name.Equals(UserData.name))
            {
                myGoldRank = i + 1 + "";
//                goChild.GetComponent<Image>().color = new Color(255 / (float)255, 255 / (float)255, 0 / (float)255, 1);
                CommonUtil.setImageSpriteByAssetBundle(goChild.GetComponent <Image>(), "main.unity3d", "di7");
            }

            goChild.layer = Content.layer;
            var  Text_Ranking = goChild.transform.Find("Text_Ranking");
            Text RankText     = Text_Ranking.GetComponent <Text>();
            var  Image_Head   = goChild.transform.Find("Image_Head");
            var  Name         = goChild.transform.Find("Name");
            var  Count        = goChild.transform.Find("Count");
            var  Ranking      = goChild.transform.Find("Ranking");
            var  Image_icon   = goChild.transform.Find("Image_icon");
            var  Image_vip    = goChild.transform.Find("Image_vip").GetComponent <Image>();
            CommonUtil.setImageSpriteByAssetBundle(Image_vip, "vip.unity3d", "user_vip_" + VipUtil.GetVipLevel(goldRankItemData.recharge));
            Image rankImage = Ranking.GetComponent <Image>();

            Count.GetComponent <Text>().text = "" + goldRankItemData.gold;
            //Image_Head.GetComponent<Image>().sprite = Resources.Load<Sprite>("Sprites/Head/head_" + goldRankItemData.head);
            goChild.GetComponent <HeadIconScript>().setIcon("head_" + goldRankItemData.head);
            Name.GetComponent <Text>().text = goldRankItemData.name;
            if (VipUtil.GetVipLevel(goldRankItemData.recharge) > 0)
            {
                Name.GetComponent <Text>().color = new Color(253 / (float)255, 239 / (float)255, 82 / (float)255, 1);
            }
            //GameUtil.setNickNameFontColor(Name.GetComponent<Text>(), VipUtil.GetVipLevel(goldRankItemData.recharge));

            Image_icon.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/icon_jinbi");

            if (i < 3)
            {
                Text_Ranking.gameObject.SetActive(false);
                Ranking.gameObject.SetActive(true);
                if (i == 1)
                {
                    CommonUtil.setImageSpriteByAssetBundle(rankImage, "main.unity3d", "award_2");
                }
                else if (i == 2)
                {
                    CommonUtil.setImageSpriteByAssetBundle(rankImage, "main.unity3d", "award_3");
                }
            }
            else
            {
                Text_Ranking.gameObject.SetActive(true);
                Ranking.gameObject.SetActive(false);
                RankText.text = i + 1 + "";
            }
        }

        if (string.IsNullOrEmpty(myGoldRank))
        {
            LogUtil.Log("未上榜");
            JifenRank.text = "我的排名:未上榜";
        }
        else
        {
            JifenRank.text = "我的排名:" + myGoldRank;
        }

        JifenCount.text = "我的金币:" + UserData.gold;

        InitMyRank();
    }