Ejemplo n.º 1
0
    public void Setup(PlayerLuckDrawData data)
    {
        m_luckDrawData = data;
        int        playerLevel = PlayerManager.Instance.FindHeroDataModel().GetUnitValue().sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL;
        GameObject iocnPrefab  = data.GetItemIconPrefab(playerLevel);
        GameObject icon        = Instantiate(iocnPrefab) as GameObject;

        icon.transform.parent        = transform;
        icon.transform.localPosition = Vector3.zero;
        icon.transform.localScale    = iocnPrefab.transform.localScale;

        SetSelected(false);


        Init();
    }
Ejemplo n.º 2
0
    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets,
                                               string[] movedAssets, string[] movedFromPath)
    {
        if (CheckResModified(importedAssets) || CheckResModified(deletedAssets) || CheckResModified(movedAssets))
        {
            string     path = System.IO.Path.Combine(RESOURCE_LUCK_DRAW_FOLDER, "PlayerLuckDraw.xml");
            TextReader tr   = new StreamReader(path);
            string     text = tr.ReadToEnd();

            if (text == null)
            {
                Debug.LogError("Bullet data file not exist");
                return;
            }
            else
            {
                XmlSpreadSheetReader.ReadSheet(text);
                XmlSpreadSheet sheet = XmlSpreadSheetReader.Output;
                string[]       keys  = XmlSpreadSheetReader.Keys;

                object[] levelIds = sheet[keys[0]];

                List <PlayerLuckDrawData> tempList = new List <PlayerLuckDrawData>();

                for (int i = 2; i < levelIds.Length; i++)
                {
                    PlayerLuckDrawData data = new PlayerLuckDrawData();
                    data.m_luckId = Convert.ToInt32(sheet["ID"][i]);


                    //string iocnPrefabPath = System.IO.Path.Combine(ASSET_LUCK_DRAW_ICON_FOLDER, iocnPrefabStr + ".prefab");
                    //data.m_iconPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(iocnPrefabPath, typeof(GameObject));

                    string tipPrefabStr  = Convert.ToString(sheet["StatusTips"][i]);
                    string tipPrefabPath = System.IO.Path.Combine(ASSET_LUCK_DRAW_ICON_FOLDER, tipPrefabStr + ".prefab");
                    data.m_tipPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(tipPrefabPath, typeof(GameObject));

                    data.m_goodsNum = new List <ItemCountGroup>();
                    string strGoodNum    = Convert.ToString(sheet["GoodsNum"][i]);
                    string iocnPrefabStr = Convert.ToString(sheet["StatusPicture"][i]);

                    if (strGoodNum != "0")
                    {
                        string[] splitNums     = strGoodNum.Split('+');
                        string[] splitIconStrs = iocnPrefabStr.Split('+');
                        for (int j = 0; j < splitNums.Length; j++)
                        {
                            ItemCountGroup group          = new ItemCountGroup();
                            string         iocnPrefabPath = System.IO.Path.Combine(ASSET_LUCK_DRAW_ICON_FOLDER, splitIconStrs[j] + ".prefab");
                            group.m_icon      = (GameObject)AssetDatabase.LoadAssetAtPath(iocnPrefabPath, typeof(GameObject));
                            group.m_itemCount = Convert.ToInt32(splitNums[j]);
                            data.m_goodsNum.Add(group);
                        }
                    }


                    tempList.Add(data);
                }
                CreateLuckDrawDataBase(tempList);
            }
        }
    }