예제 #1
0
    public void UpdateFace(Dictionary <FaceType, int> dict)
    {
        foreach (var item in dict)
        {
            var _type = item.Key;
            var _id   = item.Value;
            switch (_type)
            {
            case FaceType.眼睛:
                faces[_type].sprite = EyeConfig.Get(_id).GetSprite();
                break;

            case FaceType.嘴巴:
                faces[_type].sprite = MouthConfig.Get(_id).GetSprite();
                break;

            case FaceType.发型:
                faces[_type].sprite = HairConfig.Get(_id).GetSprite();
                break;

            case FaceType.耳朵:
                faces[_type].sprite = EarConfig.Get(_id).GetSprite();
                break;

            case FaceType.发饰:
                faces[_type].sprite = HairDecorateConfig.Get(_id).GetSprite();
                break;

            default:
                break;
            }
        }
    }
예제 #2
0
    public void UpdateFace(FaceType _type, int _id)
    {
        switch (_type)
        {
        case FaceType.眼睛:
            faces[_type].sprite = EyeConfig.Get(_id).GetSprite();
            break;

        case FaceType.嘴巴:
            faces[_type].sprite = MouthConfig.Get(_id).GetSprite();
            break;

        case FaceType.发型:
            faces[_type].sprite = HairConfig.Get(_id).GetSprite();
            break;

        case FaceType.耳朵:
            faces[_type].sprite = EarConfig.Get(_id).GetSprite();
            break;

        case FaceType.发饰:
            faces[_type].sprite = HairDecorateConfig.Get(_id).GetSprite();
            break;

        default:
            break;
        }
    }
예제 #3
0
    public void UpdateSpriteRenderSprite()
    {
        switch (facetype)
        {
        case FaceType.眼睛:
            _sprite.sprite = EyeConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite();
            break;

        case FaceType.嘴巴:
            _sprite.sprite = MouthConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite();
            break;

        case FaceType.发型:
            _sprite.sprite = HairConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite();
            break;

        case FaceType.耳朵:
            _sprite.sprite = EarConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite();
            break;

        case FaceType.发饰:
            _sprite.sprite = HairDecorateConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite();
            break;

        default:
            break;
        }
    }
예제 #4
0
    public void SetConfig(FaceType _type, int config_id, UnityAction <FaceUICell> on_click_call_back)
    {
        this.on_click_call_back = on_click_call_back;
        this._type     = _type;
        this.config_id = config_id;

        switch (_type)
        {
        case FaceType.眼睛:
            cell_image.sprite = EyeConfig.Get(config_id).GetSprite();
            break;

        case FaceType.嘴巴:

            cell_image.sprite = MouthConfig.Get(config_id).GetSprite();
            break;

        case FaceType.发型:
            cell_image.sprite = HairConfig.Get(config_id).GetSprite();
            break;

        case FaceType.耳朵:
            cell_image.sprite = EarConfig.Get(config_id).GetSprite();
            break;

        case FaceType.发饰:
            cell_image.sprite = HairDecorateConfig.Get(config_id).GetSprite();
            break;

        default:
            break;
        }
    }
예제 #5
0
    public void SetType(int t)
    {
        foreach (var item in cell_lists)
        {
            Destroy(item);
        }
        cell_lists.Clear();
        var _type = (FaceType)t;

        switch (_type)
        {
        case FaceType.眼睛:
            EyeConfig.Get(1);
            foreach (var _config in EyeConfig.Datas)
            {
                var cell = Instantiate(Cell, Root);
                cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select);
                if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type))
                {
                    Select(cell.GetComponent <FaceUICell>());
                }
                cell_lists.Add(cell);
            }
            break;

        case FaceType.嘴巴:
            MouthConfig.Get(1);
            foreach (var _config in MouthConfig.Datas)
            {
                var cell = Instantiate(Cell, Root);
                cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select);
                if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type))
                {
                    Select(cell.GetComponent <FaceUICell>());
                }
                cell_lists.Add(cell);
            }
            break;

        case FaceType.发型:
            HairConfig.Get(1);
            foreach (var _config in HairConfig.Datas)
            {
                var cell = Instantiate(Cell, Root);
                cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select);
                if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type))
                {
                    Select(cell.GetComponent <FaceUICell>());
                }
                cell_lists.Add(cell);
            }
            break;

        case FaceType.耳朵:
            EarConfig.Get(1);
            foreach (var _config in EarConfig.Datas)
            {
                var cell = Instantiate(Cell, Root);
                cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select);
                if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type))
                {
                    Select(cell.GetComponent <FaceUICell>());
                }
                cell_lists.Add(cell);
            }
            break;

        case FaceType.发饰:
            HairDecorateConfig.Get(1);
            foreach (var _config in HairDecorateConfig.Datas)
            {
                var cell = Instantiate(Cell, Root);
                cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select);
                if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type))
                {
                    Select(cell.GetComponent <FaceUICell>());
                }
                cell_lists.Add(cell);
            }
            break;

        default:
            break;
        }
    }
예제 #6
0
    public void SetModel(ActorModel _model)
    {
        foreach (var item in _model.Equipment)
        {
            Sprite sp = null;
            switch (item.Key)
            {
            case EquipmentType.鞋子:
                sp = FootConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.裤子:
                sp = PelvisConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.肩膀左:
                sp = ArmConfig.Get(item.Value).GetLsprite();
                break;

            case EquipmentType.肩膀右:
                sp = ArmConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.手链:
                sp = SleeveConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.武器:
                sp = WeaponConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.衣:
                sp = TorsoConfig.Get(item.Value).GetSprite();
                break;

            case EquipmentType.盾牌:
                sp = ShieldConfig.Get(item.Value).GetSprite();
                break;

            default:
                break;
            }
            if (equipment.ContainsKey(item.Key))
            {
                equipment[item.Key].sprite = sp;
            }
        }

        foreach (var item in _model.Faces)
        {
            Sprite sp = null;
            switch (item.Key)
            {
            case FaceType.发型:
                sp = HairConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.眼睛:
                sp = EyeConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.嘴巴:
                sp = MouthConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.耳朵:
                sp = EarConfig.Get(item.Value).GetSprite();
                break;

            case FaceType.发饰:
                sp = HairDecorateConfig.Get(item.Value).GetSprite();
                break;

            default:
                break;
            }
            face[item.Key].sprite = sp;
        }
    }