Esempio n. 1
0
    public void Refresh(CardData _cd, bool _DeckMode)
    {
        //テキスト

        //タイトル
        XLS_CardParam.Param param = DataManager.Instance.GetCardParam(_cd);


        string Title = System.String.Format
                           ("{0} LV.{1} ", new string[] { param.name, _cd.LV.ToString() });

        //調整
        CardDataText.fontSize = SkillTextSize;
        CardDataText.text     = Title;
        //文字色
//		if (!_DeckMode) {
//			if (DataManager.Deck.ContainCard (DataManager.Instance.UseDeck, _cd.uid)) {
//				CardDataText.color = new Color(0f,1f,1f);
//			} else {
//				CardDataText.color = Color.white;
//			}
//		}

//		if (_inDeck)
//			CardDataText.color = new Color(0f,1f,1f);
//		else
//			CardDataText.color = Color.white;
        //カードイメージ
        CardImage.Set(new SystemScript.CardParam().Set(_cd));
        //ノードタップ時
        GetComponent <Button> ().onClick.RemoveAllListeners();
        GetComponent <Button> ().onClick.AddListener(() => AleartNotify(nowIndex, 0));
        //詳細ボタンタップ時
        InfoButton.onClick.RemoveAllListeners();
        InfoButton.onClick.AddListener(() => AleartNotify(nowIndex, -1));
    }
Esempio n. 2
0
        public CardParam Set(CardData _cd)
        {
            Atr   = _cd.Atr;
            ID    = _cd.ID;
            LV    = _cd.LV;
            Count = _cd.Count;
            uid   = _cd.uid;

            XLS_CardParam.Param param = DataManager.Instance.GetCardParam(_cd);
            Role   = GetRoleInt(param.role);
            Rea    = param.reality;
            Groups = new List <int> ();
            for (int i = 0; i < param.group.Length; i++)
            {
                int temp = param.group [i];
                if (temp != 0)
                {
                    Groups.Add(temp);
                }
            }
            Name = param.name;
            Cost = param.cost;

            if (DataManager.Instance.LVSystem)
            {
                int[] MaxLv = { 7, 6, 5, 4 };
                Power = param.power - MaxLv [Rea] + LV;
            }
            else
            {
                Power = param.power;
            }
//			Power = param.power;
            SkillTexts  = new List <string> ();
            SkillScript = new List <string> ();
            Effect      = new List <int> ();
            EffectValue = new List <int> ();

            for (int i = 0; i < param.skill.Length; i++)
            {
                if (param.skill [i] != "")
                {
                    string skillText = param.skill [i];
                    string script    = param.script [i];
                    string inRound   = GetRoundBrackets(skillText);
                    if (script.Contains("{0}"))
                    {
                        script = string.Format(script, inRound);
                        //絶対値にする。
                        skillText = skillText.Replace("(" + inRound + ")", Mathf.Abs(int.Parse(inRound)) + "");
                    }



                    SkillTexts.Add(skillText);
                    SkillScript.Add(script);
                }
            }
            for (int i = 0; i < param.effect.Length; i++)
            {
                int eff      = param.effect [i];
                int effValue = param.value[i];
                if (eff > 0)
                {
                    Effect.Add(eff);
                    EffectValue.Add(effValue);
                }
            }
            return(this);
        }
Esempio n. 3
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            XLS_CardParam data = (XLS_CardParam)AssetDatabase.LoadAssetAtPath(exportPath, typeof(XLS_CardParam));
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <XLS_CardParam> ();
                AssetDatabase.CreateAsset((ScriptableObject)data, exportPath);
                data.hideFlags = HideFlags.NotEditable;
            }

            data.sheets.Clear();
            using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) {
                IWorkbook book = new HSSFWorkbook(stream);

                foreach (string sheetName in sheetNames)
                {
                    ISheet sheet = book.GetSheet(sheetName);
                    if (sheet == null)
                    {
                        Debug.LogError("[QuestData] sheet not found:" + sheetName);
                        continue;
                    }

                    XLS_CardParam.Sheet s = new XLS_CardParam.Sheet();
                    s.name = sheetName;

                    for (int i = 1; i <= sheet.LastRowNum; i++)
                    {
                        IRow  row  = sheet.GetRow(i);
                        ICell cell = null;

                        XLS_CardParam.Param p = new XLS_CardParam.Param();

                        cell     = row.GetCell(0); p.id = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(1); p.attribute = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(2); p.role = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(3); p.reality = (int)(cell == null ? 0 : cell.NumericCellValue);
                        p.group  = new int[3];
                        cell     = row.GetCell(4); p.group[0] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(5); p.group[1] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(6); p.group[2] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(7); p.name = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(8); p.cost = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(10); p.power = (int)(cell == null ? 0 : cell.NumericCellValue);
                        p.skill  = new string[3];
                        cell     = row.GetCell(12); p.skill[0] = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(13); p.skill[1] = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(14); p.skill[2] = (cell == null ? "" : cell.StringCellValue);
                        p.script = new string[3];
                        cell     = row.GetCell(15); p.script[0] = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(16); p.script[1] = (cell == null ? "" : cell.StringCellValue);
                        cell     = row.GetCell(17); p.script[2] = (cell == null ? "" : cell.StringCellValue);
                        p.effect = new int[3];
                        cell     = row.GetCell(18); p.effect[0] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(19); p.effect[1] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(20); p.effect[2] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        p.value  = new int[3];
                        cell     = row.GetCell(21); p.value[0] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(22); p.value[1] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell     = row.GetCell(23); p.value[2] = (int)(cell == null ? 0 : cell.NumericCellValue);
                        s.list.Add(p);
                    }
                    data.sheets.Add(s);
                }
            }

            ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject;
            EditorUtility.SetDirty(obj);
        }
    }