Пример #1
0
    public MapEditorPainterBlock() : base(0.1f, 5)
    {
        var modelKeyList = MapPrefabDefine.GetBlockModelKeyList();

        mModelIntArray = new int[modelKeyList.Count];
        mModelStrArray = new string[mModelIntArray.Length + 1];

        for (int i = 0; i < modelKeyList.Count; ++i)
        {
            mModelIntArray[i] = modelKeyList [i];
            mModelStrArray[i] = modelKeyList [i].ToString();
        }
        mModelStrArray [mModelStrArray.Length - 1] = "空";
    }
Пример #2
0
    void RefreshModel()
    {
        MapTileConfigBlock configBlock = mConfigData as MapTileConfigBlock;

        if (mCurModelKey == configBlock.GetModelKey())
        {
            return;
        }
        DestroyModel();
        mCurModelKey = configBlock.GetModelKey();
        string modelName = MapPrefabDefine.GetBlockPrefabName(mCurModelKey);

        if (null != modelName)
        {
            string     resourcePath = "Map/Prefab/Block/" + modelName;
            GameObject prefab       = Resources.Load <GameObject> (resourcePath);
            mModelObj = GameObject.Instantiate(prefab);
            Vector3 mapPos = MapLayout.Instance.GetTilePos(configBlock.tileCoord.x, configBlock.tileCoord.y);
            mModelObj.transform.SetParent(mViewTf);
            mModelObj.transform.ResetAndToWorldPos(mapPos);
            mModelObj.name = configBlock.tileCoord.ToString();
        }
    }