Ejemplo n.º 1
0
        public void Initialize(DataEquipParam _data, MasterEquipParam _master)
        {
            Clear();
            m_txtEquipName.text = _master != null ? _master.equip_name : "なし";
            if (_master == null)
            {
                return;
            }

            FieldInfo[] infoArr = new StatusParam().GetType().GetFields();
            foreach (FieldInfo info in infoArr)
            {
                FieldInfo master_info = _master.GetType().GetField(info.Name);
                if (master_info != null)
                {
                    int iParam = (int)master_info.GetValue(_master);
                    if (0 != iParam)
                    {
                        string strMessage = "";
                        if (0 < iParam)
                        {
                            strMessage = $"{info.Name}<color=blue>+{iParam}</color>";
                        }
                        else if (iParam < 0)
                        {
                            strMessage = $"{info.Name}<color=red>-{iParam}</color>";
                        }
                        GameObject go = Instantiate(m_prefParamHolder, m_goHolderRoot.transform) as GameObject;
                        go.GetComponent <TextMeshProUGUI>().text = strMessage;
                        go.SetActive(true);
                        m_goParamHolderList.Add(go);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void RefreshAssist(List <MasterEquipParam> _master_list, List <DataEquipParam> _data_list)
        {
            int[] equip_arr = new int[]
            {
                equip1,
                equip2,
                equip3,
                equip4,
                equip5,
                equip6,
            };
            assist_param = new StatusParam();

            foreach (int equip_serial in equip_arr)
            {
                DataEquipParam   data  = _data_list.Find(p => p.equip_serial == equip_serial);
                MasterEquipParam equip = data == null ? null : _master_list.Find(p => p.equip_id == data.equip_id);
                if (equip != null)
                {
                    FieldInfo[] infoArr = assist_param.GetType().GetFields();
                    foreach (FieldInfo info in infoArr)
                    {
                        FieldInfo master_info  = equip.GetType().GetField(info.Name);
                        FieldInfo assist_info  = assist_param.GetType().GetField(info.Name);
                        int       iMasterParam = (int)master_info.GetValue(equip);
                        int       iAssistParam = (int)assist_info.GetValue(assist_param);
                        assist_info.SetValue(assist_param, iMasterParam + iAssistParam);
                    }
                }
            }
        }