Exemple #1
0
        public override void Awake()
        {
            Btn         = UIUtility.SafeGetComponent <Button>(transform);
            selectTrans = UIUtility.FindTransfrom(transform, "Content/Icon/Select");
            selectTrans.gameObject.SetActive(false);
            lockTrans     = UIUtility.FindTransfrom(transform, "Lock");
            selectAnim    = UIUtility.SafeGetComponent <Animation>(selectTrans);
            _nameText     = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Content/Name"));
            _timeText     = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Content/Time"));
            _icon         = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon/BG/Image"));
            _techCost     = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Content/TechCost/Num"));
            _progressText = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Content/Progress/Value"));

            contentCanvasGroup = UIUtility.SafeGetComponent <CanvasGroup>(UIUtility.FindTransfrom(transform, "Content"));

            _rarityBG       = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon/BG"));
            _rarityEffect01 = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon/Select/SelectEffect/Image"));
            _rarityEffect02 = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon/Select/SelectEffect2/Image"));
            _rarityEffect03 = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon/Select/SelectEffect3/Image"));

            progressTrans  = UIUtility.FindTransfrom(transform, "Content/Progress");
            completeTrans  = UIUtility.FindTransfrom(transform, "Content/Complete");
            techCostTrans  = UIUtility.FindTransfrom(transform, "Content/TechCost");
            progressSlider = UIUtility.SafeGetComponent <Scrollbar>(UIUtility.FindTransfrom(progressTrans, "Scrollbar"));
        }
Exemple #2
0
        public void InitData(int blockID, int posX, int posZ)
        {
            functionBlock = FunctionBlockModule.GetFunctionBlockByBlockID(blockID);

            UIinfo = UIUtility.SafeGetComponent <BlockUIScriptInfo>(transform);
            UIinfo.SetData(this);
            ModelRoot       = UIUtility.FindTransfrom(transform, "Root/ModelRoot").gameObject;
            gameObject.name = instanceID + "[Block]";

            SetPosition(new Vector3(posX, transform.localScale.y / 2, posZ));
            info = new FunctionBlockInfoData();
            info.CreateBaseInfo(transform.position, functionBlock,
                                new FunctionBlockModifier(ModifierTarget.FunctionBlock, instanceID));

            var blockType = info.dataModel.BlockType;

            if (blockType == FunctionBlockType.ElementCapsule)
            {
                var manuBase = transform.SafeAddCmpt <ManufactoryBase>();
                manuBase.SetData();
            }
            else if (blockType == FunctionBlockType.EnergyStorageUnit)
            {
                var normalBase = transform.SafeAddCmpt <BlockNormalBase>();
                normalBase.SetData();
            }

            InitBase();
        }
Exemple #3
0
 public override void Awake()
 {
     Icon        = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Icon/Image"));
     Name        = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Unlock"));
     Unlock      = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Name"));
     RarityImage = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Icon/Rarity"));
 }
Exemple #4
0
 void InitRefrence()
 {
     mainCanvas = UIUtility.SafeGetComponent <Canvas>(Utility.SafeFindGameobject("MainCanvas").transform);
     uiCamera   = UIUtility.SafeGetComponent <Camera>(Utility.SafeFindGameobject("MainCanvas/UICamera").transform);
     pickedItem = mainCanvas.transform.Find("SPContent/PickedDistrict").GetComponent <SlotItem>();
     _enterInfo = UIUtility.SafeGetComponent <BlockEnterInfo>(UIUtility.FindTransfrom(mainCanvas.transform, "SPContent/BlockEnterInfo"));
 }
        private void InitElement()
        {
            _generalBtn.onClick.RemoveAllListeners();

            _icon.sprite     = _model.Info.typePresetData.partSprite;
            _typeIcon.sprite = _model.Info.typePresetData.TypeIcon;
            _typeText.text   = _model.Info.typePresetData.TypeName;
            _name.text       = _model.Info.customName;

            foreach (Transform trans in _propertyContentTrans)
            {
                trans.gameObject.SetActive(false);
            }

            var propertyDic = _model.Info.customDataInfo.propertyDic;

            int i = 0;

            foreach (var data in propertyDic.Values)
            {
                if (i >= Config.GlobalConfigData.AssemblePart_Max_PropertyNum)
                {
                    break;
                }
                Transform propertyItem = _propertyContentTrans.GetChild(i);
                UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(propertyItem, "Icon")).sprite = data.propertyIcon;
                UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(propertyItem, "Name")).text    = data.propertyNameText;
                UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(propertyItem, "Value")).text   = string.Format("{0} ~ {1}", data.propertyValueMin.ToString(), data.propertyValueMax.ToString());
                propertyItem.gameObject.SetActive(true);
                i++;
            }

            RefreshModeType();
        }
Exemple #6
0
 void SetElementState(bool active)
 {
     materialIcon.gameObject.SetActive(active);
     materialCountText.gameObject.SetActive(active);
     if (SlotType == FormulaModule.MaterialProductType.Enhance)
     {
         UIUtility.FindTransfrom(transform, "Bottom").gameObject.SetActive(active);
     }
 }
Exemple #7
0
 public override void Awake()
 {
     titleWaringTrans  = UIUtility.FindTransfrom(transform, "Title");
     rarityBG          = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Circle"));
     icon              = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));;
     nameText          = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Name"));
     lockIconTrans     = UIUtility.FindTransfrom(transform, "Name/Icon");
     SelectEffectTrans = UIUtility.FindTransfrom(transform, "Select");
     anim              = UIUtility.SafeGetComponent <Animation>(transform);
 }
Exemple #8
0
        public void Awake()
        {
            InputContent   = UIUtility.FindTransfrom(transform, "Input");
            OutputContent  = UIUtility.FindTransfrom(transform, "Output");
            EnhanceContent = UIUtility.FindTransfrom(transform, "Enhance");


            Enhance_Trans = UIUtility.FindTransfrom(EnhanceContent, "ManuSlotElement");
            Output_Trans  = UIUtility.FindTransfrom(OutputContent, "ManuSlotElement");
        }
        public override void Awake()
        {
            _icon                 = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Icon"));
            _typeIcon             = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Content/Type/Icon"));
            _typeText             = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Content/Type/Text"));
            _propertyContentTrans = UIUtility.FindTransfrom(transform, "Content/Property/Content");
            _name                 = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Name"));

            _clickBtn   = UIUtility.SafeGetComponent <Button>(UIUtility.FindTransfrom(transform, "Content/BG"));
            _generalBtn = UIUtility.SafeGetComponent <Button>(UIUtility.FindTransfrom(transform, "Button/ButtonGeneral02/"));
            _btnText    = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(_generalBtn.transform, "Text"));
        }
Exemple #10
0
        void InitPlanetReference()
        {
            Planet_Earth   = UIUtility.FindTransfrom(transform, "Planet_Earth");
            Planet_Mars    = UIUtility.FindTransfrom(transform, "Planet_Mars");
            Planet_Sun     = UIUtility.FindTransfrom(transform, "Planet_Sun");
            Planet_Jupiter = UIUtility.FindTransfrom(transform, "Planet_Jupiter");

            var JupiterPointTrans = UIUtility.FindTransfrom(Planet_Jupiter, "PointContent");

            for (int i = 0; i < JupiterPointTrans.childCount; i++)
            {
                _PlanetJupiter_Point.Add(i, JupiterPointTrans.GetChild(i).position);
            }
        }
Exemple #11
0
 /// <summary>
 /// 初始化更换生产线
 /// </summary>
 /// <param name="model"></param>
 /// <param name="count"></param>
 public void SetUpFormulaChangeElement(MaterialDataModel model, ushort count)
 {
     _model = model;
     _count = count;
     if (SlotType == FormulaModule.MaterialProductType.Enhance)
     {
         TitleText.text = MultiLanguage.Instance.GetTextValue(ManuSlotElement_Enhance_Title);
         UIUtility.FindTransfrom(transform, "Bottom").gameObject.SetActive(false);
     }
     else if (SlotType == FormulaModule.MaterialProductType.Input)
     {
         TitleText.text = model.Name;
     }
     materialIcon.sprite    = model.Icon;
     materialCountText.text = count.ToString();
 }
Exemple #12
0
        public void Init(ManufactFormulaInfo info, InitType type)
        {
            _info = info;
            switch (type)
            {
            case InitType.FormulaChange:
                EnhanceLine = UIUtility.FindTransfrom(transform, "EnhanceLine");
                InitFormulaSlot(InitType.FormulaChange);
                break;

            case InitType.Normal:
                InitFormulaSlot(InitType.Normal);
                RefreshManuElementTrans(_info, type);
                break;
            }
        }
Exemple #13
0
        public void CalculateSphere()
        {
            float inc = Mathf.PI * (3.0f - Mathf.Sqrt(5.0f));
            float off = 2.0f / num;

            for (int i = 0; i < num; i++)
            {
                float y   = (float)i * off - 1.0f + (off / 2.0f);
                float r   = Mathf.Sqrt(1.0f - y * y);
                float phi = i * inc;

                Vector3    pos = new Vector3(Mathf.Cos(phi) * r * size, y * size, Mathf.Sin(phi) * r * size);
                GameObject obj = new GameObject();
                obj.transform.parent        = UIUtility.FindTransfrom(transform, "PointContent");
                obj.transform.localScale    = new Vector3(1f, 1f, 1f);
                obj.transform.localPosition = pos;
                obj.gameObject.SetActive(true);
                obj.name = "Point_" + i + "-" + pos;
            }
        }
Exemple #14
0
        void Start()
        {
            FunctionBlockBase blockBase = GetComponentInParent <FunctionBlockBase>();
            var maxSize = blockBase.info.districtInfo.size;

            ArrowRight  = UIUtility.FindTransfrom(transform, "ArrowObj/Right");
            ArrowLeft   = UIUtility.FindTransfrom(transform, "ArrowObj/Left");
            ArrowTop    = UIUtility.FindTransfrom(transform, "ArrowObj/Top");
            ArrowBottom = UIUtility.FindTransfrom(transform, "ArrowObj/Bottom");

            Grid              = UIUtility.SafeGetComponent <SpriteRenderer>(UIUtility.FindTransfrom(transform, "Grid"));
            CanPlaceSprite    = Utility.LoadSprite("SpriteOutput/Map/grid_green");
            CannotPlaceSprite = Utility.LoadSprite("SpriteOutput/Map/grid_red");

            ArrowRight.localPosition = new Vector3(ArrowRight.localPosition.x - (maxSize.y / 2), 0, ArrowRight.localPosition.z);
            ArrowLeft.localPosition  = new Vector3(ArrowLeft.localPosition.x + (maxSize.y / 2), 0, ArrowLeft.localPosition.z);

            ArrowTop.localPosition    = new Vector3(ArrowTop.localPosition.x, 0, ArrowTop.localPosition.z - (maxSize.x / 2));
            ArrowBottom.localPosition = new Vector3(ArrowBottom.localPosition.x, 0, ArrowBottom.localPosition.z + (maxSize.x / 2));

            Grid.size = maxSize;
            Grid.transform.localPosition = new Vector3(0, -transform.localScale.y / 2, 0);
            ShowGrid(false);
        }
Exemple #15
0
 private void Awake()
 {
     _name  = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Name"));
     _count = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Value"));
     _icon  = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));
 }
Exemple #16
0
 private void Awake()
 {
     _icon = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BGLine/Icon"));
     _text = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "BGLine/Name"));
     _btn  = UIUtility.SafeGetComponent <Button>(transform);
 }
Exemple #17
0
 public override void Awake()
 {
     _content = UIUtility.SafeGetComponent<Text>(UIUtility.FindTransfrom(transform, "Text"));
     _btn = UIUtility.SafeGetComponent<Button>(transform);
     _anim = UIUtility.SafeGetComponent<Animator>(transform);
 }
Exemple #18
0
 public override void Awake()
 {
     materialIcon      = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Icon"));
     materialCountText = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Value"));
     TitleText         = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Title/Text"));
 }
Exemple #19
0
 public override void Awake()
 {
     _icon  = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));
     _count = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "Value"));
 }
Exemple #20
0
 void Awake()
 {
     _anim = UIUtility.SafeGetComponent <Animation>(transform);
     _name = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(transform, "BG/Name"));
     _icon = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "BG/Icon"));
 }
 private void Awake()
 {
     lockTrans = UIUtility.FindTransfrom(transform, "Lock");
     empty     = UIUtility.FindTransfrom(transform, "Empty");
     icon      = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(transform, "Empty/Icon"));
 }