فهرست منبع

剧情对话半身像

guodong 2 سال پیش
والد
کامیت
14034bdd37
21فایلهای تغییر یافته به همراه193 افزوده شده و 40 حذف شده
  1. 2 1
      FGUIProject/assets/Main/componentsDialog/CompDialogHead.xml
  2. 5 3
      FGUIProject/assets/Main/componentsDialog/Component1.xml
  3. 7 0
      FGUIProject/assets/Main/componentsDialog/ComponentHead.xml
  4. 1 0
      FGUIProject/assets/Main/package.xml
  5. 1 22
      GameClient/Assets/Editor/Excel/CodeBuilder.cs
  6. 1 1
      GameClient/Assets/Game/HotUpdate/Data/CustomSuitDataManager.cs
  7. 26 1
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpObj.cs
  8. 1 1
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs
  9. 1 0
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs
  10. 1 1
      GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs
  11. 8 4
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_CompDialogHead.cs
  12. 0 3
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_Component1.cs
  13. 74 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComponentHead.cs
  14. 11 0
      GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComponentHead.cs.meta
  15. 33 3
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs
  16. BIN
      GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes
  17. 4 0
      GameClient/Assets/ResIn/Prefab/SceneDressUpFight.prefab
  18. BIN
      GameClient/Assets/ResIn/UI/Main/Main_atlas0!a.png
  19. BIN
      GameClient/Assets/ResIn/UI/Main/Main_atlas0.png
  20. BIN
      GameClient/Assets/ResIn/UI/Main/Main_fui.bytes
  21. 17 0
      GameClient/Assets/Resources/Live2D/Cubism/Shaders/Unlit.shader

+ 2 - 1
FGUIProject/assets/Main/componentsDialog/CompDialogHead.xml

@@ -5,8 +5,9 @@
     <image id="n18_f4xv" name="n18" src="nmnb2q" fileName="imagesDialog/dhjm_jqdh_1.png" xy="-12,-32" group="n20_rkrw"/>
     <text id="n15_nmnb" name="txtName" xy="82,-28" pivot="0.5,0" size="244,64" group="n20_rkrw" font="ui://eg2y0ldpwonotjc" fontSize="48" color="#fef5e3" autoClearText="true" text="名字五个字"/>
     <group id="n20_rkrw" name="n20" xy="-12,-32" size="431,74"/>
+    <component id="n21_z7b0" name="compDressUp" src="ndrd7j" fileName="componentsDialog/Component1.xml" xy="-28,38" size="290,408"/>
+    <component id="n19_f4xv" name="comphead" src="z7b0ja" fileName="componentsDialog/ComponentHead.xml" xy="-28,47" size="290,408"/>
     <text id="n16_nmnb" name="txtContent" xy="260,75" size="706,320" fontSize="42" color="#806744" leading="12" letterSpacing="3" ubb="true" autoSize="none" autoClearText="true" text="孔雀东南飞,五里一徘徊孔雀东南飞,五里一徘徊孔雀东南飞,五里一徘徊孔雀东南飞,五里一徘徊孔雀东南飞,五里一徘徊孔雀东南飞,五里一徘徊"/>
     <component id="n17_nmnb" name="iconNext" src="nmnb33" fileName="componentsDialog/CompArrow.xml" xy="912,348"/>
-    <component id="n19_f4xv" name="comphead" src="ndrd7j" fileName="componentsDialog/Component1.xml" xy="-41,47"/>
   </displayList>
 </component>

+ 5 - 3
FGUIProject/assets/Main/componentsDialog/Component1.xml

@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="290,408">
+<component size="290,408" mask="n16_z7b0">
   <displayList>
-    <loader id="n14_nmnb" name="head" xy="0,0" pivot="0.5,0" size="290,408" aspect="true" scale="-1,1" url="ui://mfvz4q8kndrd7i" align="center"/>
-    <graph id="n15_94m1" name="holder" xy="144,666" size="1,1" scale="-1,1" touchable="false"/>
+    <graph id="n15_94m1" name="holder" xy="144,489" size="1,1" scale="-1,1" touchable="false"/>
+    <graph id="n16_z7b0" name="n16" xy="-243,-300" size="1383,708" type="rect" fillColor="#ff000000">
+      <relation target="" sidePair="bottom-bottom"/>
+    </graph>
   </displayList>
 </component>

+ 7 - 0
FGUIProject/assets/Main/componentsDialog/ComponentHead.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="290,408">
+  <displayList>
+    <loader id="n14_nmnb" name="head" xy="0,0" pivot="0.5,0" size="290,408" aspect="true" scale="-1,1" url="ui://mfvz4q8kndrd7i" align="center"/>
+    <graph id="n15_94m1" name="holder" xy="144,666" size="1,1" scale="-1,1" touchable="false"/>
+  </displayList>
+</component>

+ 1 - 0
FGUIProject/assets/Main/package.xml

@@ -461,6 +461,7 @@
     <image id="v461j7" name="zjm_e_6.png" path="/images/"/>
     <image id="t31nj8" name="zd_tgtgt.png" path="/images/"/>
     <component id="t31nj9" name="ButtonSkip1.xml" path="/componentsDialog/"/>
+    <component id="z7b0ja" name="ComponentHead.xml" path="/componentsDialog/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\Main" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 1 - 22
GameClient/Assets/Editor/Excel/CodeBuilder.cs

@@ -28,7 +28,6 @@ namespace GFGEditor
         private static List<int> _allIndexs = new List<int>();
         private static Dictionary<string, string> _idDic = new Dictionary<string, string>();
         private static Dictionary<string, string> _itemTypeDicByName = new Dictionary<string, string>();
-        private static Dictionary<string, string> _headAniDicByName = new Dictionary<string, string>();
 
         public static void GenerateCode(ExcelWorksheet worksheet, string configName, string configArrayName)
         {
@@ -393,11 +392,6 @@ namespace GFGEditor
                     HandleItemCfgField(keyValue, name, ref value);
                     values.Add(value);
                 }
-                else if (configArrayName == nameof(StoryDialogCfgArray) && name == "headAni" && !string.IsNullOrEmpty(value))
-                {
-                    HandleStoryDialogCfgField(keyValue, name, ref value);
-                    values.Add(value);
-                }
                 else
                 {
                     string _value = GetValue(configArrayName, worksheet, name, row, i);
@@ -416,10 +410,7 @@ namespace GFGEditor
 
                 }
             }
-            if (!_headAniDicByName.ContainsKey(headAniKey) && configArrayName == nameof(HeadAniCfgArray) && !string.IsNullOrEmpty(headAniKey) && !string.IsNullOrEmpty(headAniValue))
-            {
-                _headAniDicByName.Add(headAniKey, headAniValue);
-            }
+
             SQLiteHelper.Instance.InsertValues(configArrayName, values.ToArray());
         }
 
@@ -462,19 +453,7 @@ namespace GFGEditor
                 }
             }
         }
-        private static void HandleStoryDialogCfgField(string idStr, string fieldName, ref string value)
-        {
 
-            if (!_headAniDicByName.ContainsKey(value))
-            {
-                ET.Log.Error(string.Format("剧情对话.xlsx  头像动画  {0} 无资源", value));
-                value = "";
-            }
-            else
-            {
-                value = _headAniDicByName[value];
-            }
-        }
         private static void CreateParamsString(List<string> keyNames, List<string> keyTypes, out string paramStr, out string colNames, out string colValues)
         {
             paramStr = "";

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/CustomSuitDataManager.cs

@@ -48,7 +48,7 @@ namespace GFGGame
             return suitSavedData;
         }
 
-        public static CustomSuitData GetCurrentSuitList()
+        public static CustomSuitData GetCurrentSuitData()
         {
             return GetSuitList(currentIndex);
         }

+ 26 - 1
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObj.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 using System;
 using System.Linq;
 using ET;
+using static PlasticPipe.PlasticProtocol.Messages.Serialization.ItemHandlerMessagesSerialization;
 
 namespace GFGGame
 {
@@ -565,16 +566,40 @@ namespace GFGGame
         }
 
         //取消动作
-        public void CancelAction()
+        public void CancelAction(bool changeToStand = false)
         {
             if (_dressUpData.actionId <= 0)
             {
                 return;
             }
+            var tempActionId = _dressUpData.actionId;
             _dressUpData.actionId = 0;
+            if(changeToStand)
+            {
+                SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(tempActionId);
+                List<int> items = new List<int>(suitCfg.partsArr);
+                if (suitCfg.partsOptionalArr != null && suitCfg.partsOptionalArr.Length > 0)
+                {
+                    items.AddRange(suitCfg.partsOptionalArr);
+                }
+                int subType = 0;
+                foreach (int itemId in items)
+                {
+                    if (DressUpMenuItemDataManager.CheckHasItem(itemId))
+                    {
+                        subType = ItemUtilCS.GetItemSubType(itemId);
+                        bool replaceableByAction = SuitCfgArray.Instance.CheckItemReaplaceableByAction(itemId, tempActionId);
+                        if (!replaceableByAction)
+                        {
+                            AddOrRemove(itemId, false, true);
+                        }
+                    }
+                }
+            }
             checkDefaultItem();
             UpdateWholeBodyView();
         }
 
+        
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs

@@ -12,7 +12,7 @@ namespace GFGGame
         public DressUpObj dressUpObj;
 
 
-        public DressUpObjUI(string prefabName)
+        public DressUpObjUI(string prefabName = "SceneDressUp")
         {
             _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath(prefabName));
             dressUpObj = new DressUpObj();

+ 1 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -38,6 +38,7 @@ namespace GFGGame
                         parentObj = role.gameObject;
                     }
                 }
+                showAni = showAni || itemCfg.subType == ConstDressUpItemType.ZHUANG_RONG;
                 if (resLayer > 0)
                 {
                     string layerName = "";

+ 1 - 1
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -36,7 +36,7 @@ namespace GFGGame
             DressUpUtil.AddAssetReleaser(tf1.gameObject, resPath);
             spr1.sprite = sp1;
             //角色
-            CustomSuitData suitSavedData = CustomSuitDataManager.GetCurrentSuitList();
+            CustomSuitData suitSavedData = CustomSuitDataManager.GetCurrentSuitData();
             MyDressUpHelper.dressUpObj.setSceneObj(sceneObj.transform.Find("Scene").gameObject, false, true, null, false);
             MyDressUpHelper.dressUpObj.PutOnDressUpData(suitSavedData.dressUpData);
         }

+ 8 - 4
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_CompDialogHead.cs

@@ -9,9 +9,10 @@ namespace UI.Main
         public GComponent target;
         public GImage m_bg;
         public GTextField m_txtName;
+        public UI_Component1 m_compDressUp;
+        public UI_ComponentHead m_comphead;
         public GTextField m_txtContent;
         public UI_CompArrow m_iconNext;
-        public UI_Component1 m_comphead;
         public const string URL = "ui://mfvz4q8knmnb31";
         public const string PACKAGE_NAME = "Main";
         public const string RES_NAME = "CompDialogHead";
@@ -61,19 +62,22 @@ namespace UI.Main
         {
             m_bg = (GImage)comp.GetChild("bg");
             m_txtName = (GTextField)comp.GetChild("txtName");
+            m_compDressUp = (UI_Component1)UI_Component1.Create(comp.GetChild("compDressUp"));
+            m_comphead = (UI_ComponentHead)UI_ComponentHead.Create(comp.GetChild("comphead"));
             m_txtContent = (GTextField)comp.GetChild("txtContent");
             m_iconNext = (UI_CompArrow)UI_CompArrow.Create(comp.GetChild("iconNext"));
-            m_comphead = (UI_Component1)UI_Component1.Create(comp.GetChild("comphead"));
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_bg = null;
             m_txtName = null;
+            m_compDressUp.Dispose();
+            m_compDressUp = null;
+            m_comphead.Dispose();
+            m_comphead = null;
             m_txtContent = null;
             m_iconNext.Dispose();
             m_iconNext = null;
-            m_comphead.Dispose();
-            m_comphead = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 0 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_Component1.cs

@@ -7,7 +7,6 @@ namespace UI.Main
     public partial class UI_Component1
     {
         public GComponent target;
-        public GLoader m_head;
         public GGraph m_holder;
         public const string URL = "ui://mfvz4q8kndrd7j";
         public const string PACKAGE_NAME = "Main";
@@ -56,12 +55,10 @@ namespace UI.Main
 
         private void Init(GComponent comp)
         {
-            m_head = (GLoader)comp.GetChild("head");
             m_holder = (GGraph)comp.GetChild("holder");
         }
         public void Dispose(bool disposeTarget = false)
         {
-            m_head = null;
             m_holder = null;
             if(disposeTarget && target != null)
             {

+ 74 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComponentHead.cs

@@ -0,0 +1,74 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.Main
+{
+    public partial class UI_ComponentHead
+    {
+        public GComponent target;
+        public GLoader m_head;
+        public GGraph m_holder;
+        public const string URL = "ui://mfvz4q8kz7b0ja";
+        public const string PACKAGE_NAME = "Main";
+        public const string RES_NAME = "ComponentHead";
+        private static UI_ComponentHead _proxy;
+
+        public static UI_ComponentHead Create(GObject gObject = null)
+        {
+            var ui = new UI_ComponentHead();
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_ComponentHead Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_ComponentHead();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static void ProxyEnd()
+        {
+            if (_proxy != null)
+            {
+                _proxy.Dispose();
+            }
+        }
+
+        public static void ClearProxy()
+        {
+            ProxyEnd();
+            _proxy = null;
+        }
+
+        private void Init(GComponent comp)
+        {
+            m_head = (GLoader)comp.GetChild("head");
+            m_holder = (GGraph)comp.GetChild("holder");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_head = null;
+            m_holder = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ComponentHead.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f6873109164814d4caeee0baa41739d1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 33 - 3
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -15,6 +15,7 @@ namespace GFGGame
         private GameObject _sceneObject;
         private GameObject _scenePrefab;
         private GameObject _npcHead;
+        private DressUpObjUI _dressUpObjUI;
         private GoWrapper _npcWrapper;
         private GTextField _wordTextField;
         //剧情完成回调
@@ -46,6 +47,9 @@ namespace GFGGame
                 _sceneObject = null;
             }
 
+            _dressUpObjUI?.Dispose();
+            _dressUpObjUI = null;
+
             _wordTextField = null;
             _arrow = null;
             _isShowLetters = false;
@@ -97,6 +101,10 @@ namespace GFGGame
             {
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
             }
+            if(_dressUpObjUI == null)
+            {
+                _dressUpObjUI = new DressUpObjUI();
+            }
             _speedAutoPlay = FightDataManager.Instance.dialogSpeed;
             _autoPlay = false;
             UpdateSpeedUpBtn();
@@ -361,15 +369,37 @@ namespace GFGGame
             }
             if (!string.IsNullOrEmpty(headAniRes))
             {
+                var headAniCfg = HeadAniCfgArray.Instance.GetCfg(headAniRes);
                 _ui.m_dialogText.target.visible = false;
                 _ui.m_dialogName.target.visible = false;
                 _ui.m_dialogHead.target.visible = true;
                 _ui.m_dialogHead.m_txtName.text = roleName;
                 _ui.m_dialogHead.m_comphead.m_head.visible = false;
                 _ui.m_dialogHead.m_comphead.m_holder.visible = true;
-                string resPath = ResPathUtil.GetViewEffectPath("ui_nzbq", headAniRes);
-                SceneController.AddObjectToView(_npcHead, _npcWrapper, _ui.m_dialogHead.m_comphead.m_holder, resPath, out _npcHead, out _npcWrapper);
-                // _npcHead.transform.localScale = new Vector3(-100, 100, 100);
+
+                if (headAniCfg.faceId > 0)
+                { 
+                    //换装表情
+                    _ui.m_dialogHead.m_compDressUp.target.visible = true;
+                    _ui.m_dialogHead.m_comphead.target.visible = false;
+                    _dressUpObjUI.ResetSceneObj(80, true, false, null, false);
+                    _dressUpObjUI.dressUpObj.PutOnDressUpData(CustomSuitDataManager.GetCurrentSuitData().dressUpData);
+                    if(_dressUpObjUI.dressUpObj.actionId > 0)
+                    {
+                        _dressUpObjUI.dressUpObj.CancelAction(true);
+                    }
+                    _dressUpObjUI.dressUpObj.AddOrRemove(headAniCfg.faceId, false);
+                    _dressUpObjUI.UpdateWrapper(_ui.m_dialogHead.m_compDressUp.m_holder);
+                }
+                else
+                {
+                    //独立动画
+                    _ui.m_dialogHead.m_compDressUp.target.visible = false;
+                    _ui.m_dialogHead.m_comphead.target.visible = true;
+                    string resPath = ResPathUtil.GetViewEffectPath("ui_nzbq", headAniCfg.headAni);
+                    SceneController.AddObjectToView(null, _npcWrapper, _ui.m_dialogHead.m_comphead.m_holder, resPath, out _npcHead, out _npcWrapper);
+                }
+
                 _wordTextField = _ui.m_dialogHead.m_txtContent;
                 _arrow = _ui.m_dialogHead.m_iconNext;
             }

BIN
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes


+ 4 - 0
GameClient/Assets/ResIn/Prefab/SceneDressUpFight.prefab

@@ -222,6 +222,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: Role
       objectReference: {fileID: 0}
+    - target: {fileID: 8605298645749227663, guid: 8c54818580e6de44cbe90f73003c8b25, type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 8c54818580e6de44cbe90f73003c8b25, type: 3}
 --- !u!4 &8934048988926551774 stripped

BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes


+ 17 - 0
GameClient/Assets/Resources/Live2D/Cubism/Shaders/Unlit.shader

@@ -32,6 +32,13 @@ Shader "Live2D Cubism/Unlit"
         [PerRendererData] cubism_MaskTexture("cubism_Internal", 2D) = "white" {}
         [PerRendererData] cubism_MaskTile("cubism_Internal", Vector) = (0, 0, 0, 0)
         [PerRendererData] cubism_MaskTransform("cubism_Internal", Vector) = (0, 0, 0, 0)
+
+        //对FairyGUI自定义遮罩生效
+        _StencilComp("Stencil Comparison", Float) = 8
+        _Stencil("Stencil ID", Float) = 0
+        _StencilOp("Stencil Operation", Float) = 0
+        _StencilWriteMask("Stencil Write Mask", Float) = 255
+        _StencilReadMask("Stencil Read Mask", Float) = 255
     }
     SubShader
     {
@@ -44,6 +51,16 @@ Shader "Live2D Cubism/Unlit"
             "CanUseSpriteAtlas" = "True"
         }
 
+        //对FairyGUI自定义遮罩生效
+        Stencil
+        {
+            Ref[_Stencil]
+            Comp[_StencilComp]
+            Pass[_StencilOp]
+            ReadMask[_StencilReadMask]
+            WriteMask[_StencilWriteMask]
+        }
+
         Cull     [_Cull]
         Lighting Off
         ZWrite   Off