public void SetEquipmentInfo(EquipmentInfo equipmentInfo)
        {
            _equipmentInfo = equipmentInfo;
            TransformUtil.ClearChildren(iconRoot, true);
            CommonEquipmentIcon icon = CommonEquipmentIcon.Create(iconRoot);

            icon.SetEquipmentInfo(_equipmentInfo);
            icon.GetEquipmentDesButton().enabled = false;
            float w = (iconRoot as RectTransform).sizeDelta.x;
            float s = w / icon.rectTransform.sizeDelta.x;

            icon.transform.localScale = new Vector3(s, s, s);

            equipmentNameText.text = Localization.Get(equipmentInfo.equipmentData.name);

            attrViewPrefab.gameObject.SetActive(true);
            TransformUtil.ClearChildren(attrRoot, true);
            for (int i = 0, count = _equipmentInfo.EquipAttribute.Count; i < count; i++)
            {
                EquipAttributeView view = Instantiate <EquipAttributeView>(attrViewPrefab);
                view.transform.SetParent(attrRoot, false);
                view.Set(_equipmentInfo.EquipAttribute[i]);
            }
            attrViewPrefab.gameObject.SetActive(false);


            strengthenText.text = Localization.Get("ui.equipments_browse_view.training");
            sellText.text       = Localization.Get("ui.equipments_browse_view.sell");
            isNewEquipmentHintImage.gameObject.SetActive(EquipmentProxy.instance.IsNewEquipment(_equipmentInfo.instanceID));
        }
Exemplo n.º 2
0
        private void RefreshEquipments()
        {
            TransformUtil.ClearChildren(weaponEquipRoot, true);
            TransformUtil.ClearChildren(armorEquipRoot, true);
            TransformUtil.ClearChildren(accessoryEquipRoot, true);

            if (_playerInfo.weaponID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(_playerInfo.weaponID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(weaponEquipRoot);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.ButtonEnable(false);
                icon.GetEquipmentDesButton().enabled = false;
            }

            if (_playerInfo.armorID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(_playerInfo.armorID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(armorEquipRoot);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.ButtonEnable(false);
                icon.GetEquipmentDesButton().enabled = false;
            }

            if (_playerInfo.accessoryID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(_playerInfo.accessoryID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(accessoryEquipRoot);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.ButtonEnable(false);
                icon.GetEquipmentDesButton().enabled = false;
            }
        }
Exemplo n.º 3
0
        public void SetEquipmentInfo(EquipmentInfo equipmentInfo)
        {
            _equipmentInfo = equipmentInfo;

            //icon
            _equipIcon = iconRoot.GetComponentInChildren <CommonEquipmentIcon>();
            if (_equipIcon == null)
            {
                _equipIcon = CommonEquipmentIcon.Create(iconRoot);
//				float s = iconRoot.sizeDelta.x/_equipIcon.rectTransform.sizeDelta.x;
//				_equipIcon.transform.localScale = new Vector3(s,s,s);
                _equipIcon.transform.SetAsFirstSibling();
                _equipIcon.GetEquipmentDesButton().enabled = false;
                _equipIcon.ButtonEnable(false);
            }
            _equipIcon.SetEquipmentInfo(_equipmentInfo);

            equipmentNameText.text = Localization.Get(_equipmentInfo.equipmentData.name);

            TransformUtil.ClearChildren(attrRoot, true);
            attrViewPrefab.gameObject.SetActive(true);
            for (int i = 0, count = _equipmentInfo.EquipAttribute.Count; i < count; i++)
            {
                EquipAttributeView view = Instantiate <EquipAttributeView>(attrViewPrefab);
                view.transform.SetParent(attrRoot, false);
                view.Set(equipmentInfo.EquipAttribute[i]);
            }
            attrViewPrefab.gameObject.SetActive(false);

            newEquipmentHintIconImage.gameObject.SetActive(EquipmentProxy.instance.IsNewEquipment(_equipmentInfo.instanceID));
        }
Exemplo n.º 4
0
        public IEnumerator RefreshCoroutine()
        {
            rootPanel.gameObject.SetActive(false);
            yield return(null);

            yield return(null);

            textTitle.text = Localization.Get(_equipInfo.equipmentData.name);
            textStory.text = Localization.Get(_equipInfo.equipmentData.description);
            DropMessageData data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Equipment, _equipInfo.equipmentData.id);

            textFrom.text = data == null ? "" : Localization.Get(data.des);

            TransformUtil.ClearChildren(iconRoot, true);
            CommonEquipmentIcon icon = CommonEquipmentIcon.Create(iconRoot);

            icon.SetEquipmentInfo(_equipInfo);
            icon.GetEquipmentDesButton().enabled = false;

            RefreshAttr();
            RefreshSpecialUse();

            float UseDeltaHeight   = (string.IsNullOrEmpty(textUse.text) ? 0 : textUse.preferredHeight) - _defaultContentLineHeight;
            float fromDeltaHeight  = (string.IsNullOrEmpty(textFrom.text) ? 0 : textFrom.preferredHeight) - _defaultContentLineHeight;
            float storyDeltaHeight = textStory.preferredHeight - _defaultContentLineHeight;

            storyBottomLineTran.localPosition += new Vector3(0, -storyDeltaHeight);
            textFrom.transform.localPosition  += new Vector3(0, UseDeltaHeight, 0);
            rootPanel.sizeDelta = new Vector2(_originSizeDelta.x, _originSizeDelta.y + UseDeltaHeight + storyDeltaHeight + fromDeltaHeight);

            float   screenHalfHeight = UIMgr.instance.designResolution.y / 2;
            Vector3 localPosition    = transform.InverseTransformPoint(_worldPos);
            float   x = 0f;
            float   y = localPosition.y;

            if (localPosition.x > 0)
            {
                x = localPosition.x - _sizeDelta.x / 2 - rootPanel.sizeDelta.x / 2 - _defaultBorderX;
            }
            else
            {
                x = localPosition.x + _sizeDelta.x / 2 + rootPanel.sizeDelta.x / 2 + _defaultBorderX;
            }
            if (localPosition.y < rootPanel.sizeDelta.y / 2 - screenHalfHeight)
            {
                y = rootPanel.sizeDelta.y / 2 - screenHalfHeight;
            }
            if (localPosition.y > screenHalfHeight - rootPanel.sizeDelta.y / 2)
            {
                y = screenHalfHeight - rootPanel.sizeDelta.y / 2;
            }
            localPosition = new Vector3(x, y);
            rootPanel.anchoredPosition3D = localPosition;
            rootPanel.gameObject.SetActive(true);
        }
Exemplo n.º 5
0
        private void RefreshEquipments()
        {
            int characterWeaponID    = 0;
            int characterArmorID     = 0;
            int characterAccessoryID = 0;

            if (PlayerInfo != null)
            {
                characterWeaponID    = PlayerInfo.weaponID;
                characterArmorID     = PlayerInfo.armorID;
                characterAccessoryID = PlayerInfo.accessoryID;
            }
            else
            {
                characterWeaponID    = HeroInfo.weaponID;
                characterArmorID     = HeroInfo.armorID;
                characterAccessoryID = HeroInfo.accessoryID;
            }
            TransformUtil.ClearChildren(weaponTran, true);
            TransformUtil.ClearChildren(armorTran, true);
            TransformUtil.ClearChildren(accessoryTran, true);
            if (characterWeaponID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(characterWeaponID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(weaponTran);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.GetEquipmentDesButton().enabled = false;
                icon.ButtonEnable(false);
                float s = weaponTran.sizeDelta.x / icon.rectTransform.sizeDelta.x;
                icon.transform.localScale = new Vector3(s, s, s);
            }

            if (characterArmorID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(characterArmorID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(armorTran);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.GetEquipmentDesButton().enabled = false;
                icon.ButtonEnable(false);
                float s = armorTran.sizeDelta.x / icon.rectTransform.sizeDelta.x;
                icon.transform.localScale = new Vector3(s, s, s);
            }
            if (characterAccessoryID != 0)
            {
                EquipmentInfo       equipmentInfo = EquipmentProxy.instance.GetEquipmentInfoByInstanceID(characterAccessoryID);
                CommonEquipmentIcon icon          = CommonEquipmentIcon.Create(accessoryTran);
                icon.SetEquipmentInfo(equipmentInfo);
                icon.GetEquipmentDesButton().enabled = false;
                icon.ButtonEnable(false);
                float s = accessoryTran.sizeDelta.x / icon.rectTransform.sizeDelta.x;
                icon.transform.localScale = new Vector3(s, s, s);
            }
        }
        public void RefreshMaterialEquipment()
        {
            EquipmentInfo[] materials = EquipmentStrengthenProxy.instance.materialsEquipInfo;
            int             selectedEquipmentCount = materials.Length;

            for (int i = 0; i < selectedEquipmentCount; i++)
            {
                TransformUtil.ClearChildren(selectedMaterialRootTran[i], true);
                if (materials[i] != null)
                {
                    CommonEquipmentIcon equipmentIconButton = CommonEquipmentIcon.CreateSmallIcon(selectedMaterialRootTran[i]);
                    equipmentIconButton.SetEquipmentInfo(materials[i]);
                    equipmentIconButton.GetEquipmentDesButton().SetDelay(0.3f);
                    equipmentIconButton.SetSelect(true);
                    equipmentIconButton.HideSelect();
                    equipmentIconButton.onClickHandler = ClickEquipmentIconButton;
                }
            }
        }
        public void OnResetScrollItemHandler(GameObject go, int index)
        {
            CommonEquipmentIcon equipButton = go.GetComponent <CommonEquipmentIcon>();

            if (equipButton != null)
            {
                EquipmentInfo info = EquipmentStrengthenProxy.instance.currentEqupmentInfoList[index];
                equipButton.SetEquipmentInfo(info);
                equipButton.GetEquipmentDesButton().SetDelay(0.3f);
                List <EquipmentInfo> materialList = EquipmentStrengthenProxy.instance.GetMaterialEquipInfoList();
                if (materialList.Contains(info))
                {
                    equipButton.SetSelect(true);
                }
                else
                {
                    equipButton.SetSelect(false);
                }
                //equipButton.transform.localScale = new Vector3(0.88f,0.88f,1);
                equipButton.onClickHandler = ClickEquipmentIconButton;
            }
        }
Exemplo n.º 8
0
        public void SetEquipmentInfo(EquipmentInfo equipmentInfo)
        {
            _equipmentInfo = equipmentInfo;
            TransformUtil.ClearChildren(equipIconRoot, true);
            CommonEquipmentIcon icon = CommonEquipmentIcon.Create(equipIconRoot);

            icon.SetEquipmentInfo(_equipmentInfo);
            icon.GetEquipmentDesButton().enabled = false;
            icon.ButtonEnable(false);



            equipmentNameText.text = Localization.Get(_equipmentInfo.equipmentData.name);

            attrViewPrefab.gameObject.SetActive(true);
            for (int i = 0, count = equipmentInfo.EquipAttribute.Count; i < count; i++)
            {
                EquipAttributeView v = Instantiate <EquipAttributeView>(attrViewPrefab);
                v.transform.SetParent(attrRoot, false);
                v.Set(equipmentInfo.EquipAttribute[i]);
            }
            attrViewPrefab.gameObject.SetActive(false);
            priceText.text = _equipmentInfo.equipmentData.price.ToString();
        }