示例#1
0
    /*method */
    /** 更新条目 */
    public void updateItem(Exchange exchange, WindowBase win)
    {
        initFather(win);
        role.onClickCallback = rideHander;
        temp = exchange.getExchangeSample();
        Mounts activeMounts = MountsManagerment.Instance.getMountsBySid(temp.exchangeSid);

        if (activeMounts != null)
        {
            storeButton.gameObject.SetActive(true);
            if (activeMounts.isInUse())
            {
                storeButton.UpdateResultButton(activeMounts, Bgeneralscrollview.ButtonStateType.stop);
                stateType = IS_CAN_STOP;
            }
            else
            {
                storeButton.UpdateResultButton(activeMounts, Bgeneralscrollview.ButtonStateType.ride);
                stateType = IS_CAN_RIDE;
            }
            updateRide(activeMounts);
            storeButton.disableButton(false);
        }
        else
        {
            Mounts exchangeMounts = MountsManagerment.Instance.createMounts(temp.exchangeSid);
            ExchangeManagerment exchangeManager = ExchangeManagerment.Instance;
            if (MountsSampleManager.Instance.getMountsSampleBySid(temp.exchangeSid).isShowTime)
            {
                storeButton.gameObject.SetActive(false);
                updateActive(exchangeMounts);
            }
            else
            {
                //这里开始检查兑换条件 优先检查VIP
                if (exchangeManager.checkConditionByAll(exchange))
                {
                    storeButton.UpdateResultButton(exchangeMounts, Bgeneralscrollview.ButtonStateType.acitve);
                    updateActive(exchangeMounts);
                    storeButton.disableButton(false);
                    stateType = IS_CAN_ACTIVE;
                }
                else
                {
                    storeButton.UpdateResultButton(exchangeMounts, Bgeneralscrollview.ButtonStateType.acitve);
                    updateActive(exchangeMounts);
                    storeButton.disableButton(true);
                    stateType = IS_CAN_UNACTIVE;
                }
            }
            updateSkillInfo(null);
        }
    }
示例#2
0
    /**把不必要的条件置灰 */
    private void updateLabel()
    {
        //先拿普通兑换前置的描述
        ExchangeManagerment exchangeManagerment = ExchangeManagerment.Instance;

        string[] strrr = exchangeManagerment.getAllPremises(temp, 0);
        string[] str1  = exchangeManagerment.getConditionsDesc(temp, 0);
        string[] str   = new string[strrr.Length];
        for (int ss = 0; ss < strrr.Length; ss++)
        {
            if (strrr[ss].StartsWith(Colors.GREEN))
            {
                str[ss] = Colors.GRENN + strrr[ss].Substring(8);
            }
            else if (strrr[ss].StartsWith(Colors.RED))
            {
                str[ss] = Colors.REDD + strrr[ss].Substring(8);
            }
            else
            {
                str[ss] = strrr[ss];
            }
        }
        int x = 0, y = 0, xx = 0, yy = 0;

        xx = str.Length + str1.Length;
        for (int i = 0; i < str.Length; i++)
        {
            if (!str[i].EndsWith(LanguageConfigManager.Instance.getLanguage("s0099")))
            {
                x++;
            }
        }
        for (int i = 0; i < str1.Length; i++)
        {
            if (str1[i].EndsWith(LanguageConfigManager.Instance.getLanguage("s0098")))
            {
                x++;
            }
        }
        if (temp.premises.Length > 1)
        {
            string[] str22 = exchangeManagerment.getAllPremises(temp, 1);
            string[] str2  = new string[str22.Length];
            for (int ss = 0; ss < str22.Length; ss++)
            {
                if (str22[ss].StartsWith(Colors.GREEN))
                {
                    str2[ss] = Colors.GRENN + str22[ss].Substring(8);
                }
                else if (strrr[ss].StartsWith(Colors.RED))
                {
                    str2[ss] = Colors.REDD + str22[ss].Substring(8);
                }
                else
                {
                    str2[ss] = str22[ss];
                }
            }

            for (int i = 0; i < str2.Length; i++)
            {
                if (str2[i].StartsWith(Colors.GRENN))
                {
                    y++;
                }
            }
            yy += str2.Length;
        }
        if (temp.conditions.Length > 1)
        {
            string[] str3 = exchangeManagerment.getConditionsDesc(temp, 1);
            yy += str3.Length;
            for (int i = 0; i < str3.Length; i++)
            {
                if (str3[i].StartsWith(Colors.GRENN))
                {
                    y++;
                }
            }
        }
        //优先把非VIP变黑
        if (yy == y && yy != 0)
        {
            for (int i = 0; i < xx; i++)
            {
                string st = conditions[i].text;
                if (st.StartsWith(Colors.GRENN) || st.StartsWith(Colors.REDD))
                {
                    st = st.Split(']')[1];
                }
                if (st.StartsWith("[u]" + Colors.REDD))
                {
                    st = st.Split(new string[] { Colors.REDD }, StringSplitOptions.None)[1];
                }
                if (st.StartsWith("[u]" + Colors.GRENN))
                {
                    st = st.Split(new string[] { Colors.GRENN }, StringSplitOptions.None)[1];
                }
                st = "[s][808080]" + st;
                conditions[i].text = st;
            }
        }
        else if (xx == x)
        {
            for (int i = 0; i < yy; i++)
            {
                string st = conditions[i + xx].text;
                if (st.StartsWith(Colors.GRENN) || st.StartsWith(Colors.REDD))
                {
                    st = st.Split(']')[1];
                }
                st = "[s][808080]" + st;
                conditions[i + xx].text = st;
            }
        }
    }
示例#3
0
    /// <summary>
    /// 描述数据写入label
    /// </summary>
    private void writeInLabel()
    {
        otherCondition.gameObject.SetActive(false);
        ExchangeManagerment exchangeManagerment = ExchangeManagerment.Instance;

        //先拿普通兑换前置的描述
        string[] strrr = exchangeManagerment.getAllPremises(temp, 0);
        string[] str   = new string[strrr.Length];
        for (int ss = 0; ss < strrr.Length; ss++)
        {
            if (strrr[ss].StartsWith(Colors.GREEN))
            {
                str[ss] = Colors.GRENN + strrr[ss].Substring(8);
            }
            else if (strrr[ss].StartsWith(Colors.RED))
            {
                str[ss] = Colors.REDD + strrr[ss].Substring(8);
            }
            else
            {
                str[ss] = strrr[ss];
            }
        }
        int k = 0;

        for (int i = 0; i < str.Length; i++)
        {
            conditions[k].text = str[i];
            if (conditions[k].text.EndsWith(LanguageConfigManager.Instance.getLanguage("s0099")))
            {
                conditions[k].text = Colors.REDD + conditions[k].text;
            }
            k++;
        }
        //在拿普通兑换的条件描述
        string[] str1 = exchangeManagerment.getConditionsDesc(temp, 0);
        for (int i = 0; i < str1.Length; i++)
        {
            if (str1[i] != "")
            {
                if (str1[i].StartsWith("[u"))
                {
                    //str1[i]="[u]"+str1[i].Split('^')[0];
                    goodsView.init(temp.conditions[0][i].costType, temp.conditions[0][i].costSid, 1);
                    BoxCollider boxCollider = goodsView.GetComponent <BoxCollider>();
                    boxCollider.center = new Vector3(conditions[k].transform.localPosition.x - 25f, conditions[k].transform.localPosition.y + 51f, boxCollider.center.z);
                    goodsView.setCountActive(false);
                    goodsView.icon.gameObject.SetActive(false);
                }
                conditions[k].text = str1[i];
                k++;
            }
        }
        //拿VIP前置条件
        if (temp.premises.Length > 1)
        {
            string[] str22 = exchangeManagerment.getAllPremises(temp, 1);
            string[] str2  = new string[str22.Length];
            for (int ss = 0; ss < str22.Length; ss++)
            {
                if (str22[ss].StartsWith(Colors.GREEN))
                {
                    str2[ss] = Colors.GRENN + str22[ss].Substring(8);
                }
                else if (strrr[ss].StartsWith(Colors.RED))
                {
                    str2[ss] = Colors.REDD + str22[ss].Substring(8);
                }
                else
                {
                    str2[ss] = str22[ss];
                }
            }
            for (int i = 0; i < str2.Length; i++)
            {
                conditions[k].text = str2[i];
                if (!otherCondition.gameObject.activeSelf)
                {
                    otherCondition.gameObject.SetActive(false);
                    otherCondition.transform.localPosition = conditions[k].transform.localPosition + new Vector3(-11f, 0f, 0f);
                }
                if (conditions[k].text.EndsWith(LanguageConfigManager.Instance.getLanguage("s0099")))
                {
                    conditions[k].text = Colors.REDD + conditions[k].text.Substring(0, conditions[k].text.Length - 5);
                }
                k++;
            }
        }
        if (temp.conditions.Length > 1)
        {
            string[] str3 = exchangeManagerment.getConditionsDesc(temp, 1);
            for (int i = 0; i < str3.Length; i++)
            {
                if (str3[i] != "")
                {
                    if (str3[i].StartsWith("[u]"))
                    {
                        //str3[i]="[u]"+str3[i].Split('^')[1];
                        goodsView.init(temp.conditions[1][i].costType, temp.conditions[1][i].costSid, 1);
                        BoxCollider boxCollider = goodsView.GetComponent <BoxCollider>();
                        boxCollider.center = new Vector3(conditions[k].transform.localPosition.x - 25f, conditions[k].transform.localPosition.y + 51f, boxCollider.center.z);
                        goodsView.setCountActive(false);
                        goodsView.icon.gameObject.SetActive(false);
                    }
                    conditions[k].text = str1[i];
                    k++;
                }
            }
        }
    }
        public int compare(object o1, object o2)
        {
            //排序 先显示激活的(骑乘,非骑乘(品质 品质一样用战斗力))
            if (o1 == null)
            {
                return(1);
            }
            if (o2 == null)
            {
                return(-1);
            }
            if (!(o1 is Exchange) || !(o2 is Exchange))
            {
                return(0);
            }
            Exchange       obj1  = (Exchange)o1;
            Exchange       obj2  = (Exchange)o2;
            ExchangeSample temp1 = obj1.getExchangeSample();
            ExchangeSample temp2 = obj2.getExchangeSample();
            MountsSample   ms1   = MountsSampleManager.Instance.getMountsSampleBySid(temp1.exchangeSid);
            MountsSample   ms2   = MountsSampleManager.Instance.getMountsSampleBySid(temp2.exchangeSid);

            if (ms1.sortIndex < ms2.sortIndex)
            {
                return(1);
            }
            MountsManagerment manager = MountsManagerment.Instance;
            Mounts            isHave1 = manager.getMountsBySid(temp1.exchangeSid);
            Mounts            isHave2 = manager.getMountsBySid(temp2.exchangeSid);

            if (isHave1 != null && isHave2 != null)
            {
                int quality1 = isHave1.getQualityId();
                int quality2 = isHave2.getQualityId();
                if (isHave1.isInUse())
                {
                    return(-1);
                }
                else if (isHave2.isInUse())
                {
                    return(1);
                }
                else
                {
                    if (quality1 == quality2)
                    {
                        int combat1 = isHave1.getMaxLevel();
                        int combat2 = isHave2.getMaxLevel();
                        if (combat1 > combat2)
                        {
                            return(-1);
                        }
                        if (combat1 < combat2)
                        {
                            return(1);
                        }
                        return(0);
                    }
                    else if (quality1 > quality2)
                    {
                        return(-1);
                    }
                    else
                    {
                        return(1);
                    }
                }
            }
            else if (isHave1 != null && isHave2 == null)
            {
                return(-1);
            }
            else if (isHave1 == null && isHave2 != null)
            {
                return(1);
            }
            else if (isHave1 == null && isHave2 == null)
            {
                ExchangeManagerment instanc = ExchangeManagerment.Instance;
                if (((instanc.isCheckPremises(temp1, 0) && instanc.isCheckConditions(temp1, 0)) || instanc.isCheckPremises(temp1, 1)) &&
                    (!(instanc.isCheckPremises(temp2, 0) && instanc.isCheckConditions(temp2, 0)) || !instanc.isCheckPremises(temp2, 1)))
                {
                    return(-1);
                }
                if (((instanc.isCheckPremises(temp2, 0) && instanc.isCheckConditions(temp2, 0)) || instanc.isCheckPremises(temp2, 1)) &&
                    (!(instanc.isCheckPremises(temp1, 0) && instanc.isCheckConditions(temp1, 0)) || !instanc.isCheckPremises(temp1, 1)))
                {
                    return(1);
                }
            }
            return(0);
        }