Пример #1
0
    GameObject NetAddBuild(int BInd, Vector3 VT) //添加Item perfab
    {
        GameObject m_Obj = Instantiate(Resources.Load("Prefab/HouseMenu/BuildingList")) as GameObject;

        m_Obj.transform.parent        = GameObject.Find("HouseList").transform;
        m_Obj.transform.localScale    = Vector3.one;
        m_Obj.transform.localPosition = VT;
        m_Obj.name = "B" + BInd.ToString();

        //挂在外部对象
        m_Obj.GetComponent <BuyBuilding>().m_HouseMenu = m_HouseMenu;
        m_Obj.GetComponent <BuyBuilding>().m_CameraMap = m_CameraMap;
        m_Obj.GetComponent <BuyBuilding>().m_ResList   = m_ResList;

        var BList = from n in MyApp.GetInstance().GetDataManager().BB()
                    where n.BType == BInd
                    where n.Lv == 1
                    select new { B_ATLAS_NAME = n.Atlas, B_ICON_NAME = n.Icon, B_NAME = n.Name, BUILD_STR = n.InfoStr, n.ID };

        foreach (var BLi in BList)
        {
            //Debug.Log("BLi.Batlasname = " + BLi.Batlasname);
            //Debug.Log("BLi.Biconname = " + BLi.Biconname);

            UIAtlas UA = Resources.Load("Atlas/House/" + BLi.B_ATLAS_NAME, typeof(UIAtlas)) as UIAtlas;
            m_Obj.transform.FindChild("HouseIcon").GetComponent <UISprite>().atlas      = UA;
            m_Obj.transform.FindChild("HouseIcon").GetComponent <UISprite>().spriteName = BLi.B_ICON_NAME;
            m_Obj.transform.FindChild("HouseName").GetComponent <UILabel>().text        = BLi.B_NAME;;
            m_Obj.transform.FindChild("BID").GetComponentInChildren <UILabel>().text    = BLi.ID.ToString();
            m_Obj.transform.FindChild("HouseInfo").GetComponent <UILabel>().text        = BLi.BUILD_STR;
        }

        return(m_Obj);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_MyBB = MyApp.GetInstance().GetDataManager().BB();
        Transform Tf = m_Items.transform.parent;

        m_ResList = Tf.GetComponent <Building>().m_ResList;
        Dt        = DateTime.Now.Ticks;
        UIEventListener.Get(m_Items).onClick = onItems;
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        float PosX       = -272;
        int   BListCount = (from n in MyApp.GetInstance().GetDataManager().BB()
                            where n.Lv == 1
                            select n).Count();

        Debug.Log("等级为一的数据个数:" + BListCount);
        for (int i = 0; i < BListCount; i++)
        {
            PosX += 272;
            Vector3 Vt = new Vector3(PosX - 272, -17f, 0);

            m_BList.Add(NetAddBuild(i, Vt));
        }
        UIEventListener.Get(m_CloseBut).onClick = onClose;
    }
Пример #4
0
    IEnumerator CopyFile()
    {
        UnityEngine.Debug.Log("persistentFilePath:" + persistentFilePath);
        Debug.Log("fromFilePath = " + fromFilePath);
        WWW www1 = new WWW(fromFilePath);

        yield return(www1);

        try{
            File.WriteAllBytes(persistentFilePath, www1.bytes);
        }catch (Exception e)
        {
            Debug.Log("Error = " + e.ToString());
        }
        www1.Dispose();

        finishLoading = true;

        MyApp.GetInstance().GetDataManager().Test();
    }
Пример #5
0
    public static bool SetSoldier(GameObject go, int id, bool isLeft)
    {
        if (go.GetComponent <SkeletonAnimation>() == null)
        {
            return(false);
        }

        //Debug.Log("SetSoldier id = " + id);
        string skel;

        if (isLeft)
        {
            //Debug.Log("isLeft SetSoldier id = " + id);
            //PlayerSoldier soldier = PlayerDataManager.GetInstance().GetSoldier(id);
            //skel = soldier.GetBaseData().Skl;
            //Debug.Log("skel = " + skel);
        }
        else
        {
            // Debug.Log("not isLeft SetSoldier id = " + id);
            if (MyApp.GetInstance().GetDataManager() == null)
            {
                Debug.Log("not isLeft SetSoldier id = " + id + "null; = " + MyApp.GetInstance());
            }
            //skel = MyApp.GetInstance().GetDataManager().GetMonsterData(id).Skl;
            //Debug.Log("skel = " + skel);
        }
        //SkeletonDataAsset skeleton = GameObject.Instantiate(Resources.Load<SkeletonDataAsset>("FightScene/" + "Skl/"+ skel + "/New SkeletonData")) as SkeletonDataAsset;
        ////Debug.Log("skeleton = " + skeleton + "----------------FightScene/" + "Skl/" + skel + "/New SkeletonData");
        //AtlasAsset assetData = GameObject.Instantiate(Resources.Load<AtlasAsset>("FightScene/" + "Skl/" + skel + "/New Atlas")) as AtlasAsset;
        //Material material = GameObject.Instantiate(Resources.Load<Material>("FightScene/" + "Skl/" + skel + "/New Material")) as Material;
        //if (!skeleton || !assetData || !material)
        //    return false;
        //skeleton.atlasAsset = assetData;
        //assetData.materials[0] = material;
        //go.GetComponent<SkeletonAnimation>().skeletonDataAsset = skeleton;
        //go.GetComponent<SkeletonAnimation>().Reset();


        return(true);
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("开始升级!!!!!!");
        m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_Sale.SetActive(false);
        m_MyBB = MyApp.GetInstance().GetDataManager().BB();

        ID    = GlobalVar.GetInstance().UpgradeID;
        Dt    = GlobalVar.GetInstance().UpgradeStartTime;
        Stime = m_MyBB[ID].UpgradeTime;

        GlobalVar.GetInstance().ceshi = ID.ToString();

        TimeCount(Stime);
        if (Stime > 0)
        {
            m_AnimationList[0].SetActive(true);
        }
        //点击动画显示建筑当前简略信息
        for (int i = 0; i < m_AnimationList.Count; i++)
        {
            UIEventListener.Get(m_AnimationList[i]).onClick = onAnimation;
        }
    }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     m_ResList = m_BObj.GetComponent <Building>().m_ResList;
     m_MyBB    = MyApp.GetInstance().GetDataManager().BB();
     UIEventListener.Get(m_Upgrade).onClick = onUpgrade;
 }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     Ind = Convert.ToInt32(m_BId.GetComponent<UILabel>().text);
     m_MyBB = MyApp.GetInstance().GetDataManager().BB();
     UIEventListener.Get(m_BuyBut).onClick = onBuyBut;
 }