예제 #1
0
    public static SceneTypeItemView Create(GameObject parent, SceneType sceneType)
    {
        if (parent == null || sceneType == null)
        {
            return(null);
        }
        GameObject        go   = NGUITools.AddChild(parent, prefab);
        SceneTypeItemView view = new  SceneTypeItemView();

        view.sceneType = sceneType;
        view.go        = go;
        view.name      = go.transform.Find("name").gameObject.GetComponent <UILabel>();
        view.pic       = go.transform.Find("pic").gameObject.GetComponent <UISprite>();
        view.go.name   = GO_PREFIX + sceneType.typeId;
        view.name.text = sceneType.name;
        view.ShowPicture();
        return(view);
    }
예제 #2
0
    private void GenerateView()
    {
        Debug.Log("GenerateView");
        ClearView();
        picIdList.Clear();
        assetIdList.Clear();
        List <SceneType> sceneTypes = LogicController.GetSceneTypes();

        for (int i = 0; i < sceneTypes.Count; ++i)
        {
            SceneTypeItemView itemView = SceneTypeItemView.Create(table, sceneTypes[i]);
            UIEventListener.Get(itemView.gameObject).onClick = ItemClick;
            itemViewList.Add(itemView);

            /*Picture picture = LogicController.GetPicture(sceneTypes[i].pictureId);
             * if (picture == null) {
             *  picIdList.Add(sceneTypes[i].pictureId);
             * }
             * else {
             *  Asset asset = LogicController.GetAsset(picture.assetId);
             *  if (asset == null) {
             *      assetIdList.Add(picture.assetId);
             *  }
             * }*/
        }
        tableComp.Reposition();

        /*
         * if (picIdList.Count != 0) {
         *  GetPictureCommand cmd = new GetPictureCommand();
         *  cmd.Callback = AfterGetPicture;
         *  cmd.PictureIds = picIdList;
         *  cmd.execute();
         * }
         * if (assetIdList.Count != 0) {
         *  GetAssetCommand cmd = new GetAssetCommand();
         *  cmd.Callback = AfterGetAsset;
         *  cmd.AssetIds = assetIdList;
         *  cmd.execute();
         * }
         * picIdList.Clear();
         * assetIdList.Clear();
         */
    }