Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | npcContent.text = m_DialogConfig.content;
|
| | |
|
| | | var npcConfig = Config.Instance.Get<NPCConfig>(m_DialogConfig.npcId);
|
| | | UI3DModelExhibition.Instance.ShowNPC(m_DialogConfig.npcId, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, npcIcon, false, true);
|
| | | var data = new UI3DModelExhibition.UI3DNPCExhibitionData()
|
| | | {
|
| | | npcId = m_DialogConfig.npcId,
|
| | | isDialogue = true,
|
| | | };
|
| | | UI3DModelExhibition.Instance.ShowNPC(npcIcon, data);
|
| | | }
|
| | |
|
| | | if (m_DialogConfig.TalkID != 0)
|
| | |
| | | int increaseNeedNum = increases[1];
|
| | | int increaseRate = increases[2] / 100;
|
| | | increaseRateItem.SetActive(true);
|
| | | RefreshGridCellUI(increaseGridCell, false,increaseId,increaseNeedNum);
|
| | | RefreshGridCellUI(increaseGridCell, false,increaseId,increaseNeedNum,NeedMatType.IncreaseItem);
|
| | | increaseText.text = Language.Get("Compose109", StringUtility.Contact(increaseRate, "%"));
|
| | | int haveIncreaseNum = playerPack.GetItemCountByID(PackType.rptItem, increaseId);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(increaseId);
|
| | |
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | ItemAttrData attrData = null;
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.IncreaseItem:
|
| | | case NeedMatType.fixedItem:
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | break;
|
| | | case NeedMatType.unfixedItem:
|
| | | case NeedMatType.addItem:
|
| | | case NeedMatType.Nothing:
|
| | | case NeedMatType.MakeItem:
|
| | | attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | break;
|
| | | |
| | | }
|
| | | }
|
| | | );
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | itemCell.Init(itemModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.IncreaseItem:
|
| | | case NeedMatType.fixedItem:
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | |
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | break;
|
| | | case NeedMatType.unfixedItem:
|
| | | case NeedMatType.addItem:
|
| | | case NeedMatType.Nothing:
|
| | | case NeedMatType.MakeItem:
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | break;
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | [SerializeField] Text m_DogzGrade;
|
| | | [SerializeField] Button m_DogzBtn;
|
| | | [SerializeField] RedpointBehaviour redpointBehav;
|
| | |
|
| | | [SerializeField] GameObject containDivideObj;
|
| | | [SerializeField] List<Image> divideDogzIcons = new List<Image>();
|
| | | DogzModel m_Model;
|
| | | DogzModel model
|
| | | {
|
| | |
| | | redpointBehav.redpointId = model.GetSingleDogzRedpointById(_dogzCfg.ID).id;
|
| | | if (isActive)
|
| | | {
|
| | | containDivideObj.SetActive(false);
|
| | | m_DogzIcon.material = MaterialUtility.GetUIDefaultGraphicMaterial();
|
| | | m_DogzName.color = UIHelper.s_NavyBrown;
|
| | | m_DogzGrade.color = UIHelper.s_BrightOrangeColor;
|
| | | }
|
| | | else
|
| | | {
|
| | | containDivideObj.SetActive(true);
|
| | | m_DogzIcon.material = MaterialUtility.GetDefaultSpriteGrayMaterial();
|
| | | m_DogzName.color = UIHelper.s_BrightWhiteColor;
|
| | | m_DogzGrade.color = UIHelper.s_BrightWhiteColor;
|
| | | for(int i = 0; i < 5; i++)
|
| | | {
|
| | | var divideImg = divideDogzIcons[i];
|
| | | divideImg.SetSprite(_dogzCfg.HeadIcon);
|
| | | divideImg.SetNativeSize();
|
| | | divideImg.rectTransform.sizeDelta = new Vector2(divideImg.rectTransform.sizeDelta.x / 2, divideImg.rectTransform.sizeDelta.y / 2);
|
| | | ItemModel _equipData = null;
|
| | | bool isEquip = model.TryGetDogzEquip(cell.index,i+101,out _equipData);
|
| | | divideImg.gameObject.SetActive(isEquip);
|
| | | }
|
| | | }
|
| | | m_DogzBtn.image.SetSprite(model.presentSelectDogz == _dogzCfg.ID ? "Title_RightWindow" : "Title_PopupWindow");
|
| | | m_DogzAssist.gameObject.SetActive(model.TryGetAssistDogzState(_dogzCfg.ID));
|
| | |
| | |
|
| | | string npcIcon = configStoryMissions.NpcIcon[IsMultistage];
|
| | |
|
| | | UI3DModelExhibition.Instance.ShowNPC(npcId, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_NPCIcon, false, true);
|
| | | var data = new UI3DModelExhibition.UI3DNPCExhibitionData()
|
| | | {
|
| | | npcId = npcId,
|
| | | isDialogue = true,
|
| | | };
|
| | | UI3DModelExhibition.Instance.ShowNPC(m_NPCIcon,data);
|
| | | }
|
| | | typesPeaker = type;
|
| | | }
|
| | |
| | | public static UI3DModelExhibition Instance { get; private set; }
|
| | |
|
| | | static UI3DModelExhibition m_InstanceClone1 = null;
|
| | | public static UI3DModelExhibition InstanceClone1
|
| | | {
|
| | | get
|
| | | {
|
| | | public static UI3DModelExhibition InstanceClone1 {
|
| | | get {
|
| | | if (m_InstanceClone1 == null)
|
| | | {
|
| | | CreateCloneStage();
|
| | |
| | | ShowPlayer(_rawImage, data);
|
| | | }
|
| | |
|
| | | public void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
|
| | | void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
|
| | | {
|
| | | StopShow();
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data)
|
| | | {
|
| | | StopShow();
|
| | | ResetCameraColor();
|
| | | var config = Config.Instance.Get<NPCConfig>(data.npcId);
|
| | | var job = 0;
|
| | | if (config.MODE.Contains("A_Zs"))
|
| | | {
|
| | | job = 1;
|
| | | }
|
| | | else if (config.MODE.Contains("A_Fs"))
|
| | | {
|
| | | job = 2;
|
| | | }
|
| | |
|
| | | var offset = config.UIModeLOffset;
|
| | | var eulerAngles = config.UIModelRotation;
|
| | | var scale = Vector3.one * config.UIModeLProportion;
|
| | |
|
| | | var isPlayer = job != 0;
|
| | | if (isPlayer)
|
| | | {
|
| | | var instance = UI3DModelFactory.LoadUINPC(data.npcId);
|
| | | if (instance == null)
|
| | | {
|
| | | DebugEx.LogFormat("无法获得npc模型资源,id :{0}", data.npcId);
|
| | | return;
|
| | | }
|
| | |
|
| | | instance.transform.SetParentEx(data.isDialogue ? m_DialogPoint : m_NPCShowPoint, offset, eulerAngles, scale);
|
| | | npcModel = instance;
|
| | | isShowingNPC = true;
|
| | |
|
| | | var ids = config.Equips.Split('|');
|
| | | var weaponId = int.Parse(ids[0]);
|
| | | var secondaryId = ids.Length > 1 ? int.Parse(ids[1]) : 0;
|
| | | var wingId = ids.Length > 3 ? int.Parse(ids[3]) : 0;
|
| | |
|
| | | playerModel.Show(instance, job, weaponId, wingId, secondaryId, m_PlayerShowPoint);
|
| | | playerModel.UnloadClothedEffect();
|
| | | playerModel.StandUp();
|
| | |
|
| | | m_PlayerShowPoint.localEulerAngles = Vector3.zero;
|
| | | isShowingPlayer = true;
|
| | |
|
| | | interactable = true;
|
| | | m_ShowCamera.enabled = true;
|
| | | if (rawImage != null)
|
| | | {
|
| | | var x = rawImage.rectTransform.rect.height * 4f / 3;
|
| | | var y = rawImage.rectTransform.rect.height;
|
| | | rawImage.rectTransform.sizeDelta = new Vector2(x, y);
|
| | | rawImage.texture = m_ShowCamera.targetTexture;
|
| | | rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial();
|
| | | m_InteractProcessor.rectTransform = rawImage.rectTransform;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ShowNPC(data.npcId, offset, eulerAngles, rawImage, data.gray, data.isDialogue);
|
| | | }
|
| | | }
|
| | |
|
| | | public void ShowNPC(int _npcId, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false)
|
| | | {
|
| | | ShowNPC(_npcId, Vector3.zero, _localEulerAngles, _rawImage, _gray, _isDialogue);
|
| | |
| | | {
|
| | | m_ShowCamera.enabled = false;
|
| | |
|
| | | if (isShowingNPC)
|
| | | {
|
| | | playerModel.Dispose();
|
| | | isShowingPlayer = false;
|
| | |
|
| | | if (npcModel != null)
|
| | | {
|
| | | npcModel.transform.localScale = Vector3.one;
|
| | |
|
| | | if (m_NpcEffect != null)
|
| | | {
|
| | | SFXPlayUtility.Instance.Release(m_NpcEffect);
|
| | |
| | | UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel);
|
| | | npcModel = null;
|
| | | }
|
| | |
|
| | | m_NPCId = 0;
|
| | | isShowingNPC = false;
|
| | | }
|
| | |
|
| | | if (isShowingHorse)
|
| | | {
|
| | | if (horseModel != null)
|
| | | {
|
| | | horseModel.transform.localScale = Vector3.one;
|
| | | UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel);
|
| | | horseModel = null;
|
| | | }
|
| | |
|
| | | m_HorseModelId = 0;
|
| | | isShowingHorse = false;
|
| | | }
|
| | |
|
| | | if (isShowingPlayer)
|
| | | {
|
| | | playerModel.Dispose();
|
| | | isShowingPlayer = false;
|
| | | }
|
| | |
|
| | | if (isShowWing)
|
| | | {
|
| | | if (wingModel != null)
|
| | | {
|
| | | wingModel.transform.localScale = Vector3.one;
|
| | |
| | | }
|
| | | m_WingModelId = 0;
|
| | | isShowWing = false;
|
| | | }
|
| | |
|
| | | if (isShowinEquipment)
|
| | | {
|
| | | if (equipmentModel != null)
|
| | | {
|
| | | UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel);
|
| | |
| | | }
|
| | | m_EquipmentModelId = 0;
|
| | | isShowinEquipment = false;
|
| | | }
|
| | |
|
| | | interactable = false;
|
| | | }
|
| | |
| | | public int secondaryId;
|
| | | public bool isDialogue;
|
| | | }
|
| | |
|
| | | public struct UI3DNPCExhibitionData
|
| | | {
|
| | | public int npcId;
|
| | | public bool gray;
|
| | | public bool isDialogue;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | {
|
| | | showPoint = _showPoint;
|
| | | job = _job;
|
| | | PutOnClothes(_job, _clothes, suitID);
|
| | |
|
| | | var jobConfig = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
|
| | | var clothesResId = 0;
|
| | | if (_clothes == 0)
|
| | | {
|
| | | clothesResId = jobConfig.BaseEquip[0];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_clothes);
|
| | | clothesResId = item == null ? clothesResId = jobConfig.BaseEquip[0] : item.ChangeOrd;
|
| | | }
|
| | | PutOnClothes(_job, clothesResId, suitID);
|
| | |
|
| | | var weaponResId = 0;
|
| | | if (_weaponId == 0)
|
| | | {
|
| | | weaponResId = jobConfig.BaseEquip[1];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_weaponId);
|
| | | weaponResId = item == null ? weaponResId = jobConfig.BaseEquip[1] : item.ChangeOrd;
|
| | | }
|
| | | PutOnWeapon(_job, _weaponId);
|
| | | PutOnSecondary(_job, _secondaryId);
|
| | | PutOnWing(_wingsId);
|
| | |
|
| | | var secondaryResId = 0;
|
| | | if (_secondaryId == 0)
|
| | | {
|
| | | if (job == 1)
|
| | | {
|
| | | secondaryResId = clothesId + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | secondaryResId = jobConfig.BaseEquip[2];
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_secondaryId);
|
| | | secondaryResId = item == null ? jobConfig.BaseEquip[2] : item.ChangeOrd;
|
| | | }
|
| | | PutOnSecondary(_job, secondaryResId);
|
| | |
|
| | | var wingsResId = 0;
|
| | | if (_wingsId != 0)
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_wingsId);
|
| | | wingsResId = item == null ? 0 : item.ChangeOrd;
|
| | | }
|
| | | PutOnWing(wingsResId);
|
| | |
|
| | | return clothesModel;
|
| | | }
|
| | |
|
| | | public GameObject Show(GameObject clothesModel, int job, int weaponResId, int wingsResId, int secondaryResId, Transform showPoint)
|
| | | {
|
| | | this.showPoint = showPoint;
|
| | | this.job = job;
|
| | | this.clothesModel = clothesModel;
|
| | | PutOnWeapon(job, weaponResId);
|
| | | PutOnSecondary(job, secondaryResId);
|
| | | PutOnWing(wingsResId);
|
| | |
|
| | | return clothesModel;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | clothesModel = null;
|
| | | clothesId = 0;
|
| | | weaponId = 0;
|
| | | wingsId = 0;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void PutOnClothes(int _job, int itemID, int suitID)
|
| | | public void PutOnClothes(int _job, int clothesResId, int suitID)
|
| | | {
|
| | | var newClothes = 0;
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
|
| | | if (itemID == 0)
|
| | | {
|
| | | newClothes = config.BaseEquip[0];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(itemID);
|
| | | newClothes = item == null ? newClothes = config.BaseEquip[0] : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | var oldClothes = clothesId;
|
| | | if (oldClothes == newClothes)
|
| | | if (clothesId == clothesResId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (oldClothes != 0)
|
| | | if (clothesId != 0)
|
| | | {
|
| | | UnloadClothes();
|
| | | }
|
| | |
|
| | | var _prefab = InstanceResourcesLoader.LoadModelRes(newClothes, true);
|
| | | var _prefab = InstanceResourcesLoader.LoadModelRes(clothesResId, true);
|
| | | if (!_prefab)
|
| | | {
|
| | | newClothes = config.BaseEquip[0];
|
| | | clothesResId = config.BaseEquip[0];
|
| | | }
|
| | |
|
| | | LoadClothes(newClothes);
|
| | | clothesId = newClothes;
|
| | | LoadClothes(clothesResId);
|
| | | clothesId = clothesResId;
|
| | |
|
| | | if (clothesModel)
|
| | | {
|
| | |
| | | wingsModel.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | }
|
| | |
|
| | | LoadClothesEffect(itemID, suitID);
|
| | | LoadClothesEffect(suitID);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void PutOnWeapon(int _job, int itemID)
|
| | | public void PutOnWeapon(int _job, int resoureceId)
|
| | | {
|
| | | var newWeapon = 0;
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
|
| | | if (itemID == 0)
|
| | | {
|
| | | newWeapon = config.BaseEquip[1];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(itemID);
|
| | | newWeapon = item == null ? config.BaseEquip[1] : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | var oldWeapon = weaponId;
|
| | | if (oldWeapon == newWeapon)
|
| | | if (oldWeapon == resoureceId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | weaponModel = null;
|
| | | }
|
| | |
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newWeapon, true);
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true);
|
| | |
|
| | | if (!prefab)
|
| | | {
|
| | | newWeapon = config.BaseEquip[1];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newWeapon, true);
|
| | | resoureceId = config.BaseEquip[1];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true);
|
| | | }
|
| | |
|
| | | if (prefab)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | weaponId = newWeapon;
|
| | | weaponId = resoureceId;
|
| | | }
|
| | |
|
| | | public void PutOnSecondary(int _job, int itemID)
|
| | | public void PutOnSecondary(int _job, int secondaryResId)
|
| | | {
|
| | | var newSecondary = 0;
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
|
| | | if (itemID == 0)
|
| | | {
|
| | | if (job == 1)
|
| | | {
|
| | | // 这里不再读取默认的副手装备,而是根据套装读取默认的手臂装备
|
| | | newSecondary = clothesId + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | newSecondary = config.BaseEquip[2];
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(itemID);
|
| | | newSecondary = item == null ? config.BaseEquip[2] : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | var oldSecondary = secondaryId;
|
| | | if (oldSecondary == newSecondary)
|
| | | if (oldSecondary == secondaryResId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | secondaryModel = null;
|
| | | }
|
| | |
|
| | | if (newSecondary != 0)
|
| | | if (secondaryResId != 0)
|
| | | {
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newSecondary, true);
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true);
|
| | | if (!prefab)
|
| | | {
|
| | | newSecondary = config.BaseEquip[2];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newSecondary, true);
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | | secondaryResId = config.BaseEquip[2];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true);
|
| | | }
|
| | |
|
| | | if (prefab)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | secondaryId = newSecondary;
|
| | | secondaryId = secondaryResId;
|
| | | }
|
| | |
|
| | | public void PutOnWing(int itemID)
|
| | | public void PutOnWing(int resourceId)
|
| | | {
|
| | | var newWings = 0;
|
| | | if (itemID != 0)
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(itemID);
|
| | | newWings = item == null ? 0 : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | var config = Config.Instance.Get<JobSetupConfig>(job);
|
| | |
|
| | | var oldWings = wingsId;
|
| | | if (newWings == oldWings)
|
| | | if (resourceId == oldWings)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | wingsModel = null;
|
| | | }
|
| | |
|
| | | if (newWings != 0)
|
| | | if (resourceId != 0)
|
| | | {
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newWings, true);
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true);
|
| | |
|
| | | if (!prefab)
|
| | | {
|
| | | newWings = config.BaseEquip[3];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(newWings, true);
|
| | | resourceId = config.BaseEquip[3];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true);
|
| | | }
|
| | |
|
| | | if (prefab)
|
| | |
| | | wingsAnimator = wingsModel.GetComponent<Animator>();
|
| | | if (wingsAnimator == null)
|
| | | {
|
| | | DebugEx.LogErrorFormat("翅膀资源{0}没有动画控制器", itemID);
|
| | | DebugEx.LogErrorFormat("翅膀资源{0}没有动画控制器", resourceId);
|
| | | }
|
| | | wingsAnimator.enabled = true;
|
| | | wingsAnimator.Play("UI_Idle", 0);
|
| | | }
|
| | | }
|
| | |
|
| | | wingsId = newWings;
|
| | | wingsId = resourceId;
|
| | | }
|
| | |
|
| | | private PlayerSuitModel SuitModel { get { return ModelCenter.Instance.GetModel<PlayerSuitModel>(); } }
|
| | | private PlayerPackModel PlayerBackModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
| | |
|
| | | public void LoadClothesEffect(int clothedID, int suitLevel)
|
| | | public void LoadClothesEffect(int suitLevel)
|
| | | {
|
| | | UnloadClothedEffect();
|
| | |
|
| New file |
| | |
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.Sprites;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | [RequireComponent(typeof(Image))]
|
| | | public class DivideImage : BaseMeshEffect, ICanvasRaycastFilter
|
| | | {
|
| | | [SerializeField]
|
| | | int m_Divide = 5;
|
| | | public int Divide { get { return m_Divide; } }
|
| | |
|
| | | [SerializeField]
|
| | | int m_CurrentDivide = 1;
|
| | | public int CurrenDivide { get { return m_CurrentDivide; } }
|
| | |
|
| | | [Range(0, 1)] |
| | | [SerializeField] |
| | | float m_FillPercent = 1f; |
| | | public float fillPercent { get { return m_FillPercent; } }
|
| | |
|
| | | [Range(4, 128)] |
| | | [SerializeField] |
| | | int m_Segements = 30; |
| | | public int segements { get { return m_Segements; } }
|
| | |
|
| | | private Image m_Image;
|
| | | public Image image { get { return m_Image ?? (m_Image = this.AddMissingComponent<Image>()); } }
|
| | |
|
| | | private List<Vector3> outterVertices;
|
| | |
|
| | | protected override void Awake()
|
| | | {
|
| | | outterVertices = new List<Vector3>();
|
| | | }
|
| | |
|
| | | public override void ModifyMesh(VertexHelper vh)
|
| | | {
|
| | | vh.Clear();
|
| | | outterVertices.Clear();
|
| | | var degreeDelta = (float)(2 * Mathf.PI / segements);
|
| | | var realSegements = (int)(segements * fillPercent);
|
| | | var width = image.rectTransform.rect.width;
|
| | | var height = image.rectTransform.rect.height;
|
| | | var uv = image.overrideSprite != null ? DataUtility.GetOuterUV(image.overrideSprite) : Vector4.zero;
|
| | | var uvCenterX = (uv.x + uv.z) * 0.5f;
|
| | | var uvCenterY = (uv.y + uv.w) * 0.5f;
|
| | | var uvScaleX = (uv.z - uv.x) / width;
|
| | | var uvScaleY = (uv.w - uv.y) / height;
|
| | | var outerArea = new Vector2(0.5f * width, 0.5f * height);
|
| | | UIVertex uiVertex;
|
| | | var position = Vector2.zero;
|
| | | var uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY);
|
| | | uiVertex = UIUtility.PackageUIVertex(position, uv0, image.color);
|
| | | vh.AddVert(uiVertex);
|
| | | var everyRad = (float)(2 * Mathf.PI / Divide);
|
| | | var currentRad = everyRad*CurrenDivide - Mathf.PI*0.1f;
|
| | | var verticeCount = 0; |
| | | var triangleCount = 0;
|
| | | verticeCount = realSegements + 1;
|
| | | uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY);
|
| | | uiVertex = UIUtility.PackageUIVertex(position, uv0, image.color);
|
| | | vh.AddVert(uiVertex);
|
| | |
|
| | | for (int i = 1; i < verticeCount; i++)
|
| | | {
|
| | | var cosA = Mathf.Cos(currentRad);
|
| | | var sinA = Mathf.Sin(currentRad);
|
| | | currentRad = currentRad - degreeDelta;
|
| | | position = new Vector2(cosA * outerArea.x, sinA * outerArea.y);
|
| | | uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY);
|
| | | uiVertex = UIUtility.PackageUIVertex(position, uv0, image.color);
|
| | | vh.AddVert(uiVertex);
|
| | | outterVertices.Add(position);
|
| | | }
|
| | |
|
| | | triangleCount = realSegements * 3;
|
| | | for (int i = 0, vIdx = 1; i < triangleCount - 3; i += 3, vIdx++)
|
| | | {
|
| | | vh.AddTriangle(vIdx, 0, vIdx + 1);
|
| | | }
|
| | | if (fillPercent == 1)
|
| | | {
|
| | | vh.AddTriangle(verticeCount - 1, 0, 1);
|
| | | }
|
| | | }
|
| | |
|
| | | public virtual bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
|
| | | {
|
| | | var sprite = image.overrideSprite;
|
| | | if (sprite == null)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | Vector2 local;
|
| | | RectTransformUtility.ScreenPointToLocalPointInRectangle(image.rectTransform, screenPoint, eventCamera, out local);
|
| | | return Contains(local, outterVertices);
|
| | | }
|
| | |
|
| | | private bool Contains(Vector2 p, List<Vector3> outterVertices)
|
| | | {
|
| | | var crossNumber = 0;
|
| | | crossNumber += UIUtility.RayCrossingCount(p, outterVertices);
|
| | | return (crossNumber & 1) == 1;
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c9a3ad38778aa9e42b4520232ebb3d73 |
| | | timeCreated: 1541142002 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |