Merge branch 'develop' into feature/embed-stone

This commit is contained in:
NguyenVanDat
2026-01-26 11:05:56 +07:00
65 changed files with 11781 additions and 3732 deletions
@@ -3644,42 +3644,6 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3394019089264214037
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5233116975597807035}
m_Layer: 5
m_Name: Sliding Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5233116975597807035
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3394019089264214037}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2343337405992641122}
m_Father: {fileID: 4269318562826283412}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3400309995061149671
GameObject:
m_ObjectHideFlags: 0
@@ -4526,7 +4490,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3841808193842114691}
- {fileID: 4269318562826283412}
m_Father: {fileID: 3413131598704007284}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -4594,9 +4557,9 @@ MonoBehaviour:
m_ScrollSensitivity: 1
m_Viewport: {fileID: 3841808193842114691}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 8166044353254338}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 1
m_HorizontalScrollbarSpacing: -3
m_VerticalScrollbarSpacing: -3
m_OnValueChanged:
@@ -6441,9 +6404,9 @@ RectTransform:
m_Father: {fileID: 3760164886363293420}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -17, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &5693552902337398956
CanvasRenderer:
@@ -6496,132 +6459,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 0
--- !u!1 &6215509840863176641
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4269318562826283412}
- component: {fileID: 3156760942193843661}
- component: {fileID: 5649692143959903235}
- component: {fileID: 8166044353254338}
m_Layer: 5
m_Name: Scrollbar Vertical
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4269318562826283412
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6215509840863176641}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5233116975597807035}
m_Father: {fileID: 3760164886363293420}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: -17}
m_Pivot: {x: 1, y: 1}
--- !u!222 &3156760942193843661
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6215509840863176641}
m_CullTransparentMesh: 1
--- !u!114 &5649692143959903235
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6215509840863176641}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8166044353254338
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6215509840863176641}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7392889747821849613}
m_HandleRect: {fileID: 2343337405992641122}
m_Direction: 2
m_Value: 1
m_Size: 0.5000001
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &6529812165440442340
GameObject:
m_ObjectHideFlags: 0
@@ -6959,81 +6796,6 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &6825428412888061072
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2343337405992641122}
- component: {fileID: 1253204253337680264}
- component: {fileID: 7392889747821849613}
m_Layer: 5
m_Name: Handle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2343337405992641122
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6825428412888061072}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5233116975597807035}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1253204253337680264
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6825428412888061072}
m_CullTransparentMesh: 1
--- !u!114 &7392889747821849613
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6825428412888061072}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &6853716367817320825
GameObject:
m_ObjectHideFlags: 0
@@ -8864,7 +8626,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8395333742829132721, guid: 9456de25596014039bd4d0d3927b709a, type: 3}
propertyPath: m_AnchoredPosition.y
value: 191.5136
value: 336.93
objectReference: {fileID: 0}
- target: {fileID: 8395333742829132721, guid: 9456de25596014039bd4d0d3927b709a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -10,8 +10,8 @@ GameObject:
m_Component:
- component: {fileID: 5053903421260846465}
- component: {fileID: 4314770845850481090}
- component: {fileID: 4762263782091224632}
- component: {fileID: 4986645933044111193}
- component: {fileID: 1062363862839909147}
m_Layer: 5
m_Name: TreeViewItem
m_TagString: Untagged
@@ -31,7 +31,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3882154025378162395}
- {fileID: 2024997316782034639}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -51,19 +51,36 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3428dd2e9dd644e0b0cb408bd3202f21, type: 3}
m_Name:
m_EditorClassIdentifier:
m_text: {fileID: 1383932928540251694}
m_text:
legacy: {fileID: 0}
tmp: {fileID: 1383932928540251694}
m_Button: {fileID: 1762532130762754577}
_levelSprites:
- {fileID: 21300000, guid: e09a5d2cb3c3f4c858754a1e90a44abd, type: 3}
- {fileID: 21300000, guid: 73873399fec964578b62204f20c40517, type: 3}
_expandButton: {fileID: 1715406348461528812}
_collapseButton: {fileID: 8676942769405651249}
_expandToggle: {fileID: 5502308808383608272}
_expandText:
legacy: {fileID: 0}
tmp: {fileID: 8373064842616042426}
_space: {fileID: 5541755240357469011}
m_uItemData: 0
_treeLevel: 0
isLastItem: 0
OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &4762263782091224632
--- !u!114 &4986645933044111193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 700152255263326765}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 1
--- !u!114 &1062363862839909147
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -82,27 +99,13 @@ MonoBehaviour:
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &4986645933044111193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 700152255263326765}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &2040002976300010419
GameObject:
m_ObjectHideFlags: 0
@@ -115,6 +118,7 @@ GameObject:
- component: {fileID: 2230410216357545400}
- component: {fileID: 9062463037674165507}
- component: {fileID: 1762532130762754577}
- component: {fileID: 4801006375863435037}
m_Layer: 5
m_Name: MainButton
m_TagString: Untagged
@@ -129,20 +133,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040002976300010419}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5827054231092576763}
- {fileID: 7277676979067820762}
- {fileID: 2849245307131571463}
m_Father: {fileID: 5053903421260846465}
m_Father: {fileID: 2024997316782034639}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 313, y: 91}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2230410216357545400
CanvasRenderer:
@@ -165,14 +167,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 0.011764706}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: e09a5d2cb3c3f4c858754a1e90a44abd, type: 3}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -226,6 +228,26 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &4801006375863435037
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040002976300010419}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 0
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 0.5
m_FlexibleHeight: -1
m_LayoutPriority: 2
--- !u!1 &2916175606199835458
GameObject:
m_ObjectHideFlags: 0
@@ -261,8 +283,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 3.5497}
m_SizeDelta: {x: 0, y: -7.0993}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0.00000023841858}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5842649278580849339
CanvasRenderer:
@@ -319,14 +341,14 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 40
m_fontSizeBase: 40
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 15
m_fontSizeMax: 40
m_fontStyle: 0
m_HorizontalAlignment: 2
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
@@ -383,7 +405,7 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &4773363917894322918
--- !u!1 &6587684749681441909
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -391,133 +413,184 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2849245307131571463}
- component: {fileID: 8656005255261122099}
- component: {fileID: 9103345587361145036}
- component: {fileID: 8676942769405651249}
- component: {fileID: 2374156541160748953}
- component: {fileID: 5062486824527634889}
- component: {fileID: 7099288759002186546}
- component: {fileID: 8373064842616042426}
m_Layer: 5
m_Name: CollapseBtn
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2849245307131571463
--- !u!224 &5062486824527634889
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4773363917894322918}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_GameObject: {fileID: 6587684749681441909}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: -1, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3882154025378162395}
m_Father: {fileID: 7277676979067820762}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 156.5, y: 3.5497}
m_SizeDelta: {x: 313, y: 83.901}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.00048828125, y: 0}
m_SizeDelta: {x: 40.883, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8656005255261122099
--- !u!222 &7099288759002186546
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4773363917894322918}
m_GameObject: {fileID: 6587684749681441909}
m_CullTransparentMesh: 1
--- !u!114 &9103345587361145036
--- !u!114 &8373064842616042426
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4773363917894322918}
m_GameObject: {fileID: 6587684749681441909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 9de07872267c5419b9fa9c849eb45858, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8676942769405651249
m_text: +
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &6592915584227539970
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2930138263853700511}
- component: {fileID: 5541755240357469011}
m_Layer: 5
m_Name: Space
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2930138263853700511
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6592915584227539970}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2024997316782034639}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5541755240357469011
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4773363917894322918}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 9103345587361145036}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2374156541160748953
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4773363917894322918}
m_GameObject: {fileID: 6592915584227539970}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_IgnoreLayout: 0
m_MinWidth: 0
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
@@ -535,10 +608,10 @@ GameObject:
- component: {fileID: 7277676979067820762}
- component: {fileID: 885853373149276158}
- component: {fileID: 1569122208421759741}
- component: {fileID: 1715406348461528812}
- component: {fileID: 9213068811979301399}
- component: {fileID: 5502308808383608272}
- component: {fileID: 8681673894369501558}
m_Layer: 5
m_Name: ExpandBtn
m_Name: ExpandToggle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -555,13 +628,14 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3882154025378162395}
m_Children:
- {fileID: 5062486824527634889}
m_Father: {fileID: 2024997316782034639}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 156.5, y: 3.5497}
m_SizeDelta: {x: 313, y: 83.901}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &885853373149276158
CanvasRenderer:
@@ -591,7 +665,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 252815192406529888, guid: a141ce1b94af3cf46aa0695ab5ed6cdd, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -601,7 +675,7 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &1715406348461528812
--- !u!114 &5502308808383608272
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -610,11 +684,11 @@ MonoBehaviour:
m_GameObject: {fileID: 6863650808120944178}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 0
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
@@ -642,10 +716,14 @@ MonoBehaviour:
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1569122208421759741}
m_OnClick:
toggleTransition: 1
graphic: {fileID: 0}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!114 &9213068811979301399
m_IsOn: 0
--- !u!114 &8681673894369501558
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -657,11 +735,76 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_PreferredWidth: 40
m_PreferredHeight: 40
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &7973684205123875483
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2024997316782034639}
- component: {fileID: 6485915084394087119}
m_Layer: 5
m_Name: MainContent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2024997316782034639
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7973684205123875483}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2930138263853700511}
- {fileID: 7277676979067820762}
- {fileID: 3882154025378162395}
m_Father: {fileID: 5053903421260846465}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 400, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6485915084394087119
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7973684205123875483}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 1
m_ChildScaleHeight: 1
m_ReverseArrangement: 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -1,12 +1,12 @@
fileFormatVersion: 2
guid: cd36f0d3de378e94caea2807302f7a18
guid: cfa464036967d9746abcfa0608211b2e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@@ -34,16 +34,16 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
@@ -52,9 +52,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
@@ -113,7 +113,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3553c5fdd68230c6a591df1fde22cf360896fc818007787595189f0cc036b5c
size 69312
oid sha256:eadad766c90d9a2f8f33468f1b6b21e6fd78e55f555200887eb9f6198720424a
size 76688
@@ -347,7 +347,7 @@ public static class generate_item_temp
itemdataman.set_to_classid(DATA_TYPE.DT_WEAPON_ESSENCE, data, -1);
return 0;
}
private static void generate_magic_defense<RAND_CLASS>(int[] res, List<ARMOR_ESSENCE.MagicDefence> res_list , RAND_CLASS cls,
private static void generate_magic_defense<RAND_CLASS>(int[] res, List<MagicDefence> res_list , RAND_CLASS cls,
bool b_fixed = false) //
{
float[] count_prop = {0.35f,0.25f,0.20f,0.15f,0.05f,0.051f};
@@ -403,6 +403,7 @@ public static class generate_item_temp
data = new byte[size];
int offset = 0;
short hole_num = 0;
if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP)
{
float[] drop_probability_socket = { ess.drop_probability_socket0, ess.drop_probability_socket1, ess.drop_probability_socket2 };
@@ -519,7 +520,7 @@ public static class generate_item_temp
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.mp_enhance_low, ess.mp_enhance_high, cls, LOWER.LOWER_TREND));
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.hp_enhance_low, ess.hp_enhance_high, cls, LOWER.LOWER_TREND));
int[] res = {0,0,0,0,0};
List<ARMOR_ESSENCE.MagicDefence> res_list = ess.magic_defences.ToList();
List<MagicDefence> res_list = ess.magic_defences.ToList();
generate_magic_defense(res, res_list, cls, ess.force_all_magic_defences != 0 || ess.fixed_props!=0);
WriteInt(data, ref offset, res[0]);
WriteInt(data, ref offset, res[1]);
@@ -558,6 +559,413 @@ public static class generate_item_temp
itemdataman.set_to_classid(DATA_TYPE.DT_ARMOR_ESSENCE, data, -1);
return 0;
}
public static int generate_decoration<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls,
GEN_ADDON_MODE normal_addon ,item_tag_t tag,List<int> sa_list = null)
{
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
int i=0;
data = new byte[0];
size = 0;
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
if(obj == null || datatype != DATA_TYPE.DT_DECORATION_ESSENCE)
{
return -1;
}
DECORATION_ESSENCE ess = (DECORATION_ESSENCE)obj;
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(DECORATION_ESSENCE)));
// ׶
uint hole_num = 0; //׶Ŀ
// addons
byte[] addon_buf = new byte[itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS*Marshal.SizeOf(typeof(itemdataman._addon))];
float[] probability_addon_num = { ess.probability_addon_num0, ess.probability_addon_num1, ess.probability_addon_num2, ess.probability_addon_num3, ess.probability_addon_num4 };
uint addon_num = (uint)element_data.RandSelect<RAND_CLASS, LOWER>(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //ԱĿĿ
uint addon_size = 0;
if(ess.fixed_props != 0)
{
addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_DECORATION_ESSENCE, ess.addons.Select(a => (int)a.id_addon).ToList(), addon_buf,0, addon_num);
}
else
{
if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP)
addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE, ess.addons.Select(a => (int)a.id_addon).ToList(), 32, addon_buf,0, addon_num);
else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_PRODUCE)
addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE, ess.rands.Select(a => (int)a.id_rand).ToList(), 32, addon_buf,0, addon_num);
else if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC)
{
addon_size = itemdataman.generate_spec_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE,addon_buf,0,itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list);
}
else
{
addon_size = 0;
addon_num = 0;
}
}
size += addon_size;
//tag size
//ASSERT(tag_size >= sizeof(short));
size += tag.size;
// allocate the buffer with exact length
data = new byte[size];
int offset = 0;
WriteUInt(data, ref offset, id); //ƷģID
WriteUInt(data, ref offset, 1); //Ʒ
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //ƷĶѵ
object sub_type_temp = itemdataman._edm.get_data_ptr(ess.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref datatype);
if(sub_type_temp == null || datatype != DATA_TYPE.DT_DECORATION_SUB_TYPE)
{
return -1;
}
DECORATION_SUB_TYPE sub_type = (DECORATION_SUB_TYPE)sub_type_temp;
WriteInt(data, ref offset, (int)(sub_type.equip_mask|(addon_num>0?0x40000000:0))); //ƷĿװ־
WriteUInt(data, ref offset, ess.proc_type); //ƷĴʽ
WriteInt(data, ref offset, (int)DATA_TYPE.DT_DECORATION_ESSENCE); //ƷӦID
WriteInt(data, ref offset, (int)DATA_TYPE.DT_DECORATION_ESSENCE); //ƷӦID
if(ess.has_guid == 1){
int g1,g2;
itemdataman.get_item_guid(id,out g1,out g2);
WriteInt(data, ref offset, g1); //ƷӦID guid
WriteInt(data, ref offset, g2); //ƷӦID guid
}
else{
WriteInt(data, ref offset, 0); //ƷӦID guid
WriteInt(data, ref offset, 0); //ƷӦID guid
}
WriteInt(data, ref offset, ess.price); //Ʒļ۸
WriteInt(data, ref offset, 0); //ʱ
int content_length = 0;
int content_length_ptr = offset;
WriteInt(data, ref offset, 0);
int item_content = offset;
WriteInt(data, ref offset, 0);
content_length = (int)(size - offset);
WriteInt(data, ref content_length_ptr, content_length);
WriteInt(data, ref item_content, offset);
// prerequisition
int require_ptr = offset;
WriteShort(data, ref offset, (short)ess.require_level);
WriteShort(data, ref offset, (short)(ess.character_combo_id&0xFFFF));
WriteShort(data, ref offset, (short)ess.require_strength);
WriteShort(data, ref offset, (short)ess.require_tili);
WriteShort(data, ref offset, (short)ess.require_agility);
WriteShort(data, ref offset, (short)ess.require_energy);
int temp2 = element_data.RandNormal<RAND_CLASS, LOWER>(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND);
int temp;
if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0)
{
temp = temp2;
}
else
{
temp = element_data.RandNormal<RAND_CLASS, UPPER>(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND);
if(temp > temp2) temp = temp2;
}
WriteInt(data, ref offset, temp); //prerequisition durability
WriteInt(data, ref offset, temp2); //prerequisition max_durability
//߱ǩעǩڱСͱ֮
WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(DECORATION_ESSENCE))); //װСֽڣ
WriteByte(data, ref offset, tag.type); // MadeFrom
WriteByte(data, ref offset, (byte)tag.size);
//
int essence_ptr = offset;
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.damage_low, ess.damage_high, cls, LOWER.LOWER_TREND)); //int damage;
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.magic_damage_low, ess.magic_damage_high, cls, LOWER.LOWER_TREND)); //int magic_damage;
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.defence_low, ess.defence_high, cls, LOWER.LOWER_TREND)); //int defense;
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.armor_enhance_low, ess.armor_enhance_high, cls, LOWER.LOWER_TREND)); //int armor;
//
int[] res = {0,0,0,0,0};
List<MagicDefence> res_list = ess.magic_defences.ToList<MagicDefence>();
generate_magic_defense(res,res_list,cls,ess.fixed_props!=0);
WriteInt(data, ref offset, res[0]);
WriteInt(data, ref offset, res[1]);
WriteInt(data, ref offset, res[2]);
WriteInt(data, ref offset, res[3]);
WriteInt(data, ref offset, res[4]);
// ׶
WriteShort(data, ref offset, (short)hole_num); //׶Ŀ
WriteShort(data, ref offset, (short)0); //׶
// addon
WriteInt(data, ref offset, (int)addon_num);
int addon_sld = offset;
addon_data addon_data = new addon_data();
prerequisition prerequisition = new prerequisition();
// Read prerequisition from data buffer (where it was written) once before the loop
int require_ptr_copy = require_ptr;
ReadPrerequisition(data, ref require_ptr_copy, out prerequisition);
for(i = 0; i < addon_num; i++)
{
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition);
addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int);
}
itemdataman.update_require_data(ref prerequisition);
int require_ptr_write = require_ptr;
WritePrerequisition(data, ref require_ptr_write, prerequisition);
if(addon_size > 0)
{
Array.Copy(addon_buf, 0, data, offset, (int)addon_size);
offset += (int)addon_size;
}
itemdataman.set_to_classid(DATA_TYPE.DT_DECORATION_ESSENCE, data, -1);
//if id == 335 log all addon data
if(id == 335)
{
BMLogger.Log("Log for item with id: " + id);
for(int j = 0; j < addon_num; j++)
{
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
BMLogger.Log("addon_data.id: " + addon_data.id);
}
}
return 0;
}
public static int generate_projectile<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls)
{
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
data = new byte[0];
size = 0;
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
if(obj == null || datatype != DATA_TYPE.DT_PROJECTILE_ESSENCE)
{
return -1;
}
PROJECTILE_ESSENCE ess = (PROJECTILE_ESSENCE)obj;
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(PROJECTILE_ESSENCE)));
byte[] addon_buf = new byte[itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS*Marshal.SizeOf(typeof(itemdataman._addon))];
uint addon_num = 4; //ԱĿĿ̶ 4
uint addon_size = 0;
addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_PROJECTILE_ESSENCE, new List<int> { (int)ess.id_addon0, (int)ess.id_addon1, (int)ess.id_addon2, (int)ess.id_addon3 }, addon_buf,0, addon_num);
size += addon_size;
//tag size
size += sizeof(short);
// allocate the buffer with exact length
data = new byte[size];
int offset = 0;
WriteUInt(data, ref offset, id); //ƷģID
WriteUInt(data, ref offset, 1); //Ʒ
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //ƷĶѵ
WriteInt(data, ref offset, (int)(itemdataman.ELEMENTDATAMAN_EQUIP_MASK_PROJECTILE|(addon_num>0?0x40000000:0))); //ƷĿװ־
WriteInt(data, ref offset, (int)ess.proc_type); //ƷĴʽ
WriteInt(data, ref offset, (int)DATA_TYPE.DT_PROJECTILE_ESSENCE); //ƷӦID
if(ess.has_guid == 1){
int g1,g2;
itemdataman.get_item_guid(id,out g1,out g2);
WriteInt(data, ref offset, g1); //ƷӦID guid
WriteInt(data, ref offset, g2); //ƷӦID guid
}
else{
WriteInt(data, ref offset, 0); //ƷӦID guid
WriteInt(data, ref offset, 0); //ƷӦID guid
}
WriteInt(data, ref offset, ess.price); //Ʒļ۸
WriteInt(data, ref offset, 0); //ʱ
int content_length = 0;
int content_length_ptr = offset;
WriteInt(data, ref offset, 0);
int item_content = offset;
WriteInt(data, ref offset, 0);
content_length = (int)(size - offset);
WriteInt(data, ref content_length_ptr, content_length);
WriteInt(data, ref item_content, offset);
// prerequisition
int require_ptr = offset;
//int6
WriteShort(data, ref offset, 0); //prerequisition level
WriteShort(data, ref offset, -1); // 0xFFFF = -1
WriteShort(data, ref offset, 0);
WriteShort(data, ref offset, 0); //prerequisition strength
WriteShort(data, ref offset, 0); //prerequisition agility
WriteShort(data, ref offset, 0); //prerequisition energy
WriteInt(data, ref offset, 1); //prerequisition durability
WriteInt(data, ref offset, 1); //prerequisition max_durability
WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(PROJECTILE_ESSENCE))); //װСֽڣ
WriteByte(data, ref offset, (byte)ITEM_MAKE_TAG.IMT_NULL);
WriteByte(data, ref offset, 0);
// projectile_essence
int essence_ptr = offset;
WriteInt(data, ref offset, (int)ess.type); //ҩ
WriteInt(data, ref offset, ess.damage_enhance); //Ĺ
WriteInt(data, ref offset, ess.damage_scale_enhance); //ձӹ
WriteInt(data, ref offset, ess.require_weapon_level_min); //Ҫȼ
WriteInt(data, ref offset, ess.require_weapon_level_max); //Ҫȼ
// ׶
WriteShort(data, ref offset, (short)0);
WriteShort(data, ref offset, (short)0);
// addon
WriteInt(data, ref offset, (int)addon_num);
int addon_sld = offset;
addon_data addon_data = new addon_data();
prerequisition prerequisition = new prerequisition();
// Read prerequisition from data buffer (where it was written) once before the loop
int require_ptr_copy = require_ptr;
ReadPrerequisition(data, ref require_ptr_copy, out prerequisition);
for(int i = 0; i < addon_num; i++)
{
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition);
addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int);
}
itemdataman.update_require_data(ref prerequisition);
int require_ptr_write = require_ptr;
WritePrerequisition(data, ref require_ptr_write, prerequisition);
if(addon_size > 0)
{
Array.Copy(addon_buf, 0, data, offset, (int)addon_size);
offset += (int)addon_size;
}
itemdataman.set_to_classid(DATA_TYPE.DT_PROJECTILE_ESSENCE, data, -1);
return 0;
}
public static int generate_fashion_item<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, item_tag_t tag)
{
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
data = new byte[0];
size = 0;
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
if(obj == null || datatype != DATA_TYPE.DT_FASHION_ESSENCE)
{
return -1;
}
FASHION_ESSENCE ess = (FASHION_ESSENCE)obj;
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(FASHION_ESSENCE)));
//ASSERT(tag_size >= 2);
size += tag.size;
object obj_sub_type = itemdataman._edm.get_data_ptr(ess.id_sub_type, idspace, ref datatype);
if(obj_sub_type == null || datatype != DATA_TYPE.DT_FASHION_SUB_TYPE)
{
return -1;
}
FASHION_SUB_TYPE sub_type = (FASHION_SUB_TYPE)obj_sub_type;
data = new byte[size];
int offset =0;
WriteUInt(data, ref offset, id); //ƷģID
WriteUInt(data, ref offset, 1); //Ʒ
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //ƷĶѵ
WriteUInt(data, ref offset, sub_type.equip_fashion_mask); //ƷĿװ־̶ֵ
WriteInt(data, ref offset, (int)ess.proc_type); //ƷĴʽ
WriteInt(data, ref offset, (int)DATA_TYPE.DT_FASHION_ESSENCE); //ƷӦID
if(ess.has_guid == 1)
{
int g1,g2;
itemdataman.get_item_guid(id,out g1,out g2);
WriteInt(data, ref offset, g1);
WriteInt(data, ref offset, g2);
}
else
{
WriteInt(data, ref offset, 0);
WriteInt(data, ref offset, 0);
}
WriteInt(data, ref offset, ess.price);
WriteInt(data, ref offset, 0);
int content_length = 0;
int content_length_ptr = offset;
WriteInt(data, ref offset, 0);
int item_content = offset;
WriteInt(data, ref offset, 0);
content_length = (int)(size - offset);
WriteInt(data, ref content_length_ptr, content_length);
WriteInt(data, ref item_content, offset);
short color = (short)element_data.RandNormal<RAND_CLASS, ANY>(0, 0x7FFF, cls, ANY.ANY_TREND);
WriteShort(data, ref offset, (short)ess.require_level);
WriteShort(data, ref offset, color);
WriteShort(data, ref offset, (short)ess.gender);
WriteByte(data, ref offset, tag.type);
WriteByte(data, ref offset, (byte)tag.size);
itemdataman.set_to_classid(DATA_TYPE.DT_FASHION_ESSENCE, data, -1);
return 0;
}
public static int generate_taskdice<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls)
{
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
data = new byte[0];
size = 0;
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
if(obj == null || datatype != DATA_TYPE.DT_TASKDICE_ESSENCE)
{
return -1;
}
TASKDICE_ESSENCE ess = (TASKDICE_ESSENCE)obj;
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(TASKDICE_ESSENCE)));
data = new byte[size];
int offset = 0;
WriteUInt(data, ref offset, id);
WriteUInt(data, ref offset, 1);
WriteInt(data, ref offset, ess.pile_num_max);
WriteInt(data, ref offset, 0);
WriteUInt(data, ref offset, ess.proc_type);
WriteInt(data, ref offset, (int)DATA_TYPE.DT_TASKDICE_ESSENCE);
if(ess.has_guid == 1)
{
int g1,g2;
itemdataman.get_item_guid(id,out g1,out g2);
WriteInt(data, ref offset, g1);
WriteInt(data, ref offset, g2);
}
else
{
WriteInt(data, ref offset, 0);
WriteInt(data, ref offset, 0);
}
WriteInt(data, ref offset, 0);
WriteInt(data, ref offset, 0);
int content_length = 0;
int content_length_ptr = offset;
WriteInt(data, ref offset, 0);
int item_content = offset;
WriteInt(data, ref offset, 0);
content_length = (int)(size - offset);
WriteInt(data, ref content_length_ptr, content_length);
WriteInt(data, ref item_content, offset);
itemdataman.set_to_classid(DATA_TYPE.DT_TASKDICE_ESSENCE, data, -1);
return 0;
}
public static int generate_tasknormalmatter<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls,
GEN_ADDON_MODE normal_addon ,item_tag_t tag,List<int> sa_list = null)
{
@@ -950,6 +1358,51 @@ public static class generate_item_temp
itemdataman.set_to_classid(DATA_TYPE.DT_PET_FOOD_ESSENCE, data, -1);
return 0;
}
public static int generate_townscroll<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls)
{
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
data = new byte[0];
size = 0;
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
if(obj == null || datatype != DATA_TYPE.DT_TOWNSCROLL_ESSENCE)
return -1;
TOWNSCROLL_ESSENCE ess = (TOWNSCROLL_ESSENCE)obj;
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(TOWNSCROLL_ESSENCE)));
data = new byte[size];
int offset = 0;
WriteUInt(data, ref offset, id);
WriteUInt(data, ref offset, 1);
WriteUInt(data, ref offset, (uint)ess.pile_num_max);
WriteInt(data, ref offset, 0);
WriteInt(data, ref offset, (int)ess.proc_type);
WriteInt(data, ref offset, (int)DATA_TYPE.DT_TOWNSCROLL_ESSENCE);
if(ess.has_guid == 1){
int g1,g2;
itemdataman.get_item_guid(id,out g1,out g2);
WriteInt(data, ref offset, g1);
WriteInt(data, ref offset, g2);
}
else{
WriteInt(data, ref offset, 0);
WriteInt(data, ref offset, 0);
}
WriteInt(data, ref offset, ess.price);
WriteInt(data, ref offset, 0);
int content_length = 0;
int content_length_ptr = offset;
WriteInt(data, ref offset, 0);
int item_content = offset;
WriteInt(data, ref offset, 0);
content_length = (int)(size - offset);
WriteInt(data, ref content_length_ptr, content_length);
WriteInt(data, ref item_content, offset);
WriteInt(data, ref offset, (int )(ess.use_time * 20)); //ʹʱ
itemdataman.set_to_classid(DATA_TYPE.DT_TOWNSCROLL_ESSENCE, data, -1);
return 0;
}
#region Write Functions
private static void WriteUInt(byte[] buf, ref int offset, uint value)
{
@@ -458,6 +458,20 @@ namespace BrewMonster
ret = generate_item_temp.generate_armor(id, ID_SPACE.ID_SPACE_ESSENCE,
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
break;
case DATA_TYPE.DT_DECORATION_ESSENCE:
ret = generate_item_temp.generate_decoration(id,ID_SPACE.ID_SPACE_ESSENCE,
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
break;
case DATA_TYPE.DT_PROJECTILE_ESSENCE:
ret = generate_item_temp.generate_projectile(id,ID_SPACE.ID_SPACE_ESSENCE,
out item,out size,SPECIFIC.SPECIFIC_RAND);
break;
case DATA_TYPE.DT_FASHION_ESSENCE:
ret = generate_item_temp.generate_fashion_item(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag);
break;
case DATA_TYPE.DT_TASKDICE_ESSENCE:
ret = generate_item_temp.generate_taskdice(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
break;
case DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE:
ret = generate_item_temp.generate_tasknormalmatter(id,ID_SPACE.ID_SPACE_ESSENCE,
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
@@ -477,6 +491,10 @@ namespace BrewMonster
case DATA_TYPE.DT_PET_FOOD_ESSENCE:
ret = generate_item_temp.generate_pet_food(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
break;
case DATA_TYPE.DT_TOWNSCROLL_ESSENCE:
ret = generate_item_temp.generate_townscroll(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
break;
default:
ret = -1;
break;
@@ -253,7 +253,12 @@ namespace BrewMonster
+ ByteToStringUtils.ByteArrayToCP936String(file_model_left) + "\n";
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MagicDefence
{
public int low; // Minimum magic defense
public int high; // Maximum magic defense
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ARMOR_MAJOR_TYPE
{
@@ -326,12 +331,7 @@ namespace BrewMonster
public int defence_low; // Minimum physical defense
public int defence_high; // Maximum physical defense
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MagicDefence
{
public int low; // Minimum magic defense
public int high; // Maximum magic defense
}
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public MagicDefence[] magic_defences; // Magic defenses for 5 elements
@@ -495,13 +495,6 @@ namespace BrewMonster
public int defence_low; // Minimum physical defense
public int defence_high; // Maximum physical defense
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MagicDefence
{
public int low; // Minimum magic defense
public int high; // Maximum magic defense
}
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public MagicDefence[] magic_defences; // Magic defenses for 5 elements
@@ -750,6 +743,7 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public ushort[] name; // Fashion sub-type name
public string Name => ByteToStringUtils.UshortArrayToCP936String(name);
public uint equip_fashion_mask; // Fashion equipment slot mask
}
@@ -774,6 +768,8 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // Matter model file path
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
@@ -1512,16 +1508,16 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_model; // Model file path
public string FileModel => ByteToStringUtils.ByteArrayToCP936String(file_model);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_model2; // Second model file path
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // Material file path
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon);
public int price; // Price
public int shop_price; // Shop price
@@ -1605,10 +1601,11 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // Material file path
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon);
public float use_time; // Use time (seconds)
public int price; // Price
@@ -1629,9 +1626,11 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // Material file path
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon);
public int price; // Price
public int shop_price; // Shop price
@@ -1746,6 +1745,7 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
public int pile_num_max; // Max stack count
public uint has_guid; // Whether item has GUID
@@ -1762,9 +1762,11 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // Material file path
public string FileMatter { get { return ByteToStringUtils.ByteArrayToCP936String(file_matter); } }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // Icon file path
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
public int price; // Price
public int shop_price; // Shop price
@@ -1783,9 +1785,10 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // matter file path
public string FileMatter { get { return ByteToStringUtils.ByteArrayToCP936String(file_matter); } }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // icon file path
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
[StructLayout(LayoutKind.Sequential)]
public struct TaskList
@@ -1854,6 +1857,7 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public ushort[] name; // name, max 15 chars
public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name);
}
public struct PROJECTILE_ESSENCE
@@ -1866,12 +1870,14 @@ namespace BrewMonster
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_model; // model file path
public string FileModel { get { return ByteToStringUtils.ByteArrayToCP936String(file_model); } }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_matter; // matter file path
public string FileMatter { get { return ByteToStringUtils.ByteArrayToCP936String(file_matter); } }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon; // icon file path
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_firegfx; // fire effect file
@@ -3015,9 +3021,11 @@ namespace BrewMonster
public string FileIcon1 => ByteToStringUtils.ByteArrayToCP936String(file_icon1);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon2; // state 2 icon path
public string FileIcon2 => ByteToStringUtils.ByteArrayToCP936String(file_icon2);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon3; // state 3 icon path
public string FileIcon3 => ByteToStringUtils.ByteArrayToCP936String(file_icon3);
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] file_icon4; // state 4 icon path
@@ -1,19 +1,170 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
/// <summary>
/// Arrow item class (cac loai mui ten)
/// </summary>
public class EC_IvtrArrow : EC_IvtrEquip
{
protected IVTR_ESSENCE_ARROW m_Essence; // Arrow essence data
// Data in database
protected PROJECTILE_TYPE m_pDBType;
protected PROJECTILE_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Arrow item class (cac loai mui ten)
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrArrow(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_ARROW;
m_Essence = new IVTR_ESSENCE_ARROW();
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (PROJECTILE_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBType = (PROJECTILE_TYPE)pDB.get_data_ptr((uint)m_pDBEssence.type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_iProcType = (int)m_pDBEssence.proc_type;
m_i64EquipMask = EC_IvtrType.EQUIP_MASK64_PROJECTILE;
}
public EC_IvtrArrow(EC_IvtrArrow other) : base(other)
{
m_pDBType = other.m_pDBType;
m_pDBEssence = other.m_pDBEssence;
m_Essence = other.m_Essence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
if (pInfoData == null || iDataLen == 0)
return true;
try
{
CECDataReader dr = new CECDataReader(pInfoData, iDataLen);
// Skip equip requirements and endurance
dr.Offset(5 * sizeof (int), CECDataReader.SEEK_CUR);
int iEssenceSize = dr.ReadInt();
//ASSERT(iEssenceSize == sizeof (IVTR_ESSENCE_ARROW));
m_Essence = new IVTR_ESSENCE_ARROW(dr.ReadData(iEssenceSize));
}
catch (Exception e)
{
Debug.LogError("CECIvtrArrow::SetItemInfo, data read error (" + e.GetType() + e.StackTrace + ")");
return false;
}
return true;
}
// Get item icon file name
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
// Get item name
public override string GetName()
{
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
if (m_pDBEssence.name != null && m_pDBEssence.name.Length > 0)
{
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBEssence.name);
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
return s;
// Fallback to legacy CP936 if Unicode was empty
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
if (!string.IsNullOrEmpty(s))
return s;
}
return base.GetName(); // Fallback to base class method
}
// Get item description text
protected override string GetNormalDesc(bool bRepair)
{
if (m_bNeedUpdate)
return "";
// Build addon and refine properties and save it
m_strDesc = "";
BuildAddOnPropDesc(null, null);
string strAddon = m_strDesc;
m_strDesc = "";
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
// Weapon requirement
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WEAPONREQ), m_Essence.iWeaponReqLow,
m_Essence.iWeaponReqHigh, m_pDBType.Name);
// Damage enhance
if (m_pDBEssence.damage_enhance != 0)
{
AddDescText(-1, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE));
AddDescText(-1, true, " %+d", m_pDBEssence.damage_enhance);
}
// Add addon properties
if (strAddon.Length > 0)
m_strDesc += strAddon;
// Price
AddPriceDesc(white, bRepair);
// Suite description
AddSuiteDesc();
// Extend description
AddExtDescText();
return m_strDesc;
}
// Get drop model for shown
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,31 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrFashion : EC_IvtrItem
public class EC_IvtrFashion : EC_IvtrEquip
{
protected int m_iGender; // required gender
protected ushort m_wColor; // color in X1R5G5B5 format
protected uint m_color; // color in X8R8G8B8 format
protected IVTR_ESSENCE_FASHION m_Essence; // Fashion essence data
// Data in database
protected FASHION_MAJOR_TYPE m_pDBMajorType;
protected FASHION_SUB_TYPE m_pDBSubType;
protected FASHION_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// </summary>
@@ -10,10 +33,210 @@ namespace PerfectWorld.Scripts.Managers
/// <param name="expire_date">Expire date</param>
public EC_IvtrFashion(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_FASHION;
m_Essence = new IVTR_ESSENCE_FASHION();
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (FASHION_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBMajorType = (FASHION_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBSubType = (FASHION_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_i64EquipMask = m_pDBSubType.equip_fashion_mask;
m_iProcType = (int)m_pDBEssence.proc_type;
// reset the info
DefaultInfo();
}
public EC_IvtrFashion(EC_IvtrFashion other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
m_pDBMajorType = other.m_pDBMajorType;
m_pDBSubType = other.m_pDBSubType;
m_Essence = other.m_Essence;
m_iGender = other.m_iGender;
m_wColor = other.m_wColor;
m_color = other.m_color;
}
// Set item detail information
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
// Note: because fashion is not an absolute equipment, so skip
// CECIvtrEquip::SetItemInfo().
if (pInfoData == null || iDataLen == 0)
{
m_bNeedUpdate = false;
return true;
}
try
{
CECDataReader dr = new CECDataReader(pInfoData, iDataLen);
var size = Marshal.SizeOf<IVTR_ESSENCE_FASHION>();
m_Essence = new IVTR_ESSENCE_FASHION(dr.ReadData(size));
}
catch (Exception e)
{
Debug.LogError("CECIvtrFashion::SetItemInfo, data read error (" + e.GetType() + e.StackTrace + ")");
return false;
}
LevelReq = m_Essence.require_level;
m_wColor = m_Essence.color;
m_iGender = m_Essence.gender;
m_color = (uint)FASHION_WORDCOLOR_TO_A3DCOLOR(m_wColor).GetHashCode();
m_bNeedUpdate = false;
return true;
}
// Get item default information from database
public override void DefaultInfo()
{
LevelReq = m_pDBEssence.require_level;
m_wColor = 0x7fff;
m_iGender = m_pDBEssence.gender;
m_color = 0xffffffff;
// these data also stored in essence, sync it here
m_Essence.require_level = LevelReq;
m_Essence.color = m_wColor;
m_Essence.gender = (ushort)m_iGender;
}
public static Color FASHION_WORDCOLOR_TO_A3DCOLOR(ushort color)
{
return new Color(((color & (0x1f << 10)) >> 7), ((color & (0x1f << 5)) >> 2), ((color & 0x1f) << 3));
}
public string GetSubTypeName()
{
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
if (m_pDBSubType.name != null && m_pDBSubType.name.Length > 0)
{
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBSubType.name);
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
return s;
// Fallback to legacy CP936 if Unicode was empty
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBSubType.name);
if (!string.IsNullOrEmpty(s))
return s;
}
return "";
}
protected override string GetNormalDesc(bool bRepair)
{
if (m_bNeedUpdate)
return "";
m_strDesc = "";
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
int namecol = DecideNameCol();
// Item name
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddBindDescText();
AddExpireTimeDesc();
// Sub class name
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), GetSubTypeName());
// Color
// Use m_iScaleType == SCALE_BUY to judge whether this item is in NPC's pack,
// this may not be a valid way
if (m_pDBEssence.equip_location != (int)enumSkinShow.enumSkinShowArmet && m_pDBEssence.equip_location != (int)enumSkinShow.enumSkinShowHand)
{
if (m_iScaleType == (int)EC_IvtrItem.ScaleType.SCALE_BUY)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
AddDescText(white, true, (" ???"));
}
else
{
// Extract RGB components from m_color (X8R8G8B8 format)
int colorRed = (int)((m_color >> 16) & 0xFF);
int colorGreen = (int)((m_color >> 8) & 0xFF);
int colorBlue = (int)(m_color & 0xFF);
string szCol = string.Format("^{0:X2}{1:X2}{2:X2}", colorRed, colorGreen, colorBlue);
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
m_strDesc += " ";
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLORRECT), szCol);
}
}
// Level requirment
if (LevelReq > 0)
{
int lcol = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
AddDescText(lcol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
}
// fashion weapon profession requirment and weapon action type
if (m_pDBEssence.equip_location == (int)enumSkinShow.enumSkinShowHand)
{
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_pDBEssence.level);
AddProfReqDesc(m_pDBEssence.character_combo_id);
AddActionTypeDescText((int)m_pDBEssence.action_type);
}
// Gender requirement
CECStringTab pFixMsg = EC_Game.GetFixedMsgs();
int col = (pHost.GetGender() == m_iGender) ? white : red;
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_GENDERREQ));
m_strDesc += " ";
if (m_iGender == (int)GENDER.GENDER_MALE)
AddDescText(col, true, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_GENDER_MALE));
else
AddDescText(col, true, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_GENDER_FEMALE));
// Price
AddPriceDesc(white, bRepair);
// Fashion level
if (m_pDBEssence.level > 0)
{
m_strDesc += "\\r";
m_strDesc += pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COL_WHITE);
for (int i=0; i < m_pDBEssence.level; i++)
m_strDesc += pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PENTAGON);
}
// Extend description
AddExtDescText();
return m_strDesc;
}
public bool HasRandomProp()
{
return false;
}
// Get drop model for shown
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
public int GetFashionSuiteID()
{
Dictionary<int, int> suiteEquipTab = EC_Game.GetSuiteEquipTab();
return suiteEquipTab.ContainsKey(TemplateId) ? suiteEquipTab[TemplateId] : 0;
}
}
}
@@ -1,20 +1,228 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrFlysword : EC_IvtrItem
/// <summary>
/// Flysword Item (Phi kiem).
/// </summary>
public class EC_IvtrFlysword : EC_IvtrEquip
{
protected int m_iCurTime; // Current time counter in ms
protected IVTR_ESSENCE_FLYSWORD m_Essence;
protected FLYSWORD_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Flysword Item (Phi kiem)
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrFlysword(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_FLYSWORD;
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (FLYSWORD_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_iProcType = (int)m_pDBEssence.proc_type;
m_i64EquipMask = EC_IvtrType.EQUIP_MASK64_FLYSWORD;
m_bUseable = true;
m_bNeedUpdate = false;
}
public EC_IvtrFlysword(EC_IvtrFlysword other) : base(other)
{
m_iCurTime = other.m_iCurTime;
m_Essence = other.m_Essence;
m_pDBEssence = other.m_pDBEssence;
MadeFrom = other.MadeFrom;
Maker = other.Maker;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
// Note: because fly sword isn't an absolute equipment, so skip
// CECIvtrEquip::SetItemInfo().
if (pInfoData == null || iDataLen == 0)
{
m_bNeedUpdate = false;
return true;
}
try
{
CECDataReader dr = new CECDataReader(pInfoData, iDataLen);
m_Essence = new IVTR_ESSENCE_FLYSWORD(dr.ReadData(Marshal.SizeOf<IVTR_ESSENCE_FLYSWORD>()));
base.ReadMakerInfo(dr);
}
catch (Exception e)
{
Debug.LogError("CECIvtrFlySword::SetItemInfo, data read error (" + e.GetType() + ")");
return false;
}
LevelReq = m_Essence.require_level;
m_bNeedUpdate = false;
m_iCurTime = m_Essence.cur_time * 1000;
return true;
}
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
protected override string GetNormalDesc(bool bRepair)
{
if (m_bNeedUpdate)
return string.Empty;
m_strDesc = "";
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddBindDescText();
// Is destroying?
AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged);
AddExpireTimeDesc();
// level
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_Essence.level);
// whether can be improved
if (IsImprovable())
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_GREEN,true,pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_FLYSWORD_IMPROVE),m_Essence.improve_level,GetMaxImproveLevel());
else
AddDescText(white,true,pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_FLYSWORD_NOIMPROVED));
// Normal fly speed bonus
if (m_Essence.speed_increase > 0)
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDFLYSPEED), m_Essence.speed_increase);
// Quick fly speed bonus
if (m_Essence.speed_increase2 > 0)
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDFLYSPEED2), m_Essence.speed_increase2);
// Remain time
if (GetMaxTime() > 0)
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_REMAINTIME), GetCurTime(), GetMaxTime());
// Profession requirement
AddProfReqDesc((uint)m_Essence.profession);
// Level requirement
if (LevelReq > 0)
{
int col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
}
// Element consume
// AddDescText(white, true, pDescTab->GetWideString(ITEMDESC_ELEMENTTIME), m_Essence.time_per_element);
// Price
AddPriceDesc(white, bRepair);
AddMakerDesc();
// Suite description
AddSuiteDesc();
// Extend description
AddExtDescText();
return m_strDesc;
}
// Get max time
protected int GetMaxTime()
{
return (int)m_Essence.max_time;
}
// Get max element number
protected int GetMaxElement()
{
return (int)((float)m_Essence.max_time / m_Essence.time_per_element + 0.5f);
}
// Get time each element equal to
protected int GetElementTime()
{
return m_Essence.time_per_element;
}
// Get number of element if time is filled to full. This is just the number
// of element which has been used
protected int GetUsedElementNum()
{
return (int)((m_Essence.max_time - GetCurTime()) / (float)m_Essence.time_per_element);
}
// Get drop model for shown
protected string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
public override bool IsRare()
{
return base.IsRare() || m_Essence.level >= 6;
}
protected bool IsImprovable()
{
return m_pDBEssence.max_improve_level > 0 && m_pDBEssence.improve_config[0].require_item_num > 0;
}
protected bool CanBeImproved()
{
if(m_pDBEssence.max_improve_level <=0) return false;
if(m_Essence.improve_level>= GetMaxImproveLevel()) return false;
return m_pDBEssence.improve_config[m_Essence.improve_level].require_item_num > 0;
}
protected int GetMaxImproveLevel()
{
int maxL = m_pDBEssence.improve_config.Length;
int i = 0;
for (i = 0; i < maxL; i++)
{
if(m_pDBEssence.improve_config[i].require_item_num == 0)
break;
}
return Mathf.Min(m_pDBEssence.max_improve_level, i);
}
protected int GetCurTime() { return m_Essence.cur_time; }
}
}
@@ -807,7 +807,8 @@ namespace BrewMonster.Scripts.Managers
var pItem = new EC_IvtrItem(tid, expire_date);
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object data = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
Debug.Log("Create item data: DataType: " + DataType);
//Active this to log the data type of item when creating an item
//Debug.Log("Create item data: DataType: " + DataType + " tid: " + tid );
switch(DataType)
{
case DATA_TYPE.DT_WEAPON_ESSENCE:
@@ -844,7 +845,7 @@ namespace BrewMonster.Scripts.Managers
pItem = new EC_IvtrFlysword(tid, expire_date);
break;
case DATA_TYPE.DT_TOWNSCROLL_ESSENCE:
pItem = new EC_IvtrTownscroll(tid, expire_date);
pItem = new EC_IvtrTownScroll(tid, expire_date);
break;
case DATA_TYPE.DT_UNIONSCROLL_ESSENCE:
pItem = new EC_IvtrUnionscroll(tid, expire_date);
@@ -859,7 +860,7 @@ namespace BrewMonster.Scripts.Managers
pItem = new EC_IvtrTossMat(tid, expire_date);
break;
case DATA_TYPE.DT_TASKMATTER_ESSENCE:
pItem = new EC_IvtrTaskmatter(tid, expire_date);
pItem = new EC_IvtrTaskItem(tid, expire_date);
break;
case DATA_TYPE.DT_STONE_ESSENCE:
pItem = new EC_IvtrStone(tid, expire_date);
@@ -77,7 +77,6 @@ namespace PerfectWorld.Scripts.Managers
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
BMLogger.Log("GetNormalDesc: m_pDBEssence.Name:" + m_pDBEssence.Name + " m_iCount:" + m_iCount);
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
@@ -194,8 +194,82 @@ namespace PerfectWorld.Scripts.Managers
}
private string GetRidingPetDesc(bool bRepair)
{
Debug.Log("GetRidingPetDesc. This is not implemented yet.");
return "";
if (m_bNeedUpdate)
return "";
m_strDesc = string.Empty;
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
int namecol = DecideNameCol();
// Item name: always use the name in template
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), m_pDBEssence.name/* GetName() */, m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), m_pDBEssence.name/* GetName() */);
AddIDDescText();
AddBindDescText();
AddExpireTimeDesc();
// ɫϢ
if (m_pPetEssence.id != 0 && m_pPetEssence.require_dye_count > 0)
{
if (m_iScaleType == (int)ScaleType.SCALE_BUY)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
AddDescText(white, true, " ???");
}
else
{
Color clr = new Color(255, 255, 255);
if (RIDINGPET.GetColor(m_Essence.color, clr))
clr = RIDINGPET.GetDefaultColor();
string strColor = string.Format("^{0:X2}{1:X2}{2:X2}", clr.r, clr.g, clr.b);
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
m_strDesc += " ";
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLORRECT), strColor);
}
}
// Food type requirement
AddFoodTypeDesc();
if (m_pPetEssence.id != 0)
{
// Pet level
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PETLEVEL), m_Essence.level);
// Move speed
float fSpeed = m_pPetEssence.speed_a + (m_Essence.level - 1) * m_pPetEssence.speed_b;
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_MOVESPEED), fSpeed);
// Profession requirement
AddProfReqDesc(m_pPetEssence.character_combo_id);
}
// Level requirement
int iLevelReq = Mathf.Max((int)m_Essence.level, m_Essence.req_level);
if (iLevelReq > 0)
{
int col = pHost.GetMaxLevelSofar() >= iLevelReq ? white : red;
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), iLevelReq);
}
// Price
AddPriceDesc(white, bRepair);
// Extend description
AddExtDescText();
return m_strDesc;
}
private string GetCombatPetDesc(bool bRepair)
{
@@ -1,19 +1,84 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
/// <summary>
/// Task Dice Item (Tui qua random).
/// This is a part of IvtrTaskItem(C++)
/// </summary>
public class EC_IvtrTaskDice : EC_IvtrItem
{
protected TASKDICE_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Task Dice Item
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTaskDice(int tid, int expire_date) : base(tid, expire_date)
/// <param name="tid"></param>
/// <param name="expire_date"></param>
public EC_IvtrTaskDice(int tid, int expire_date) : base(tid, expire_date)
{
}
m_iCID = (int)InventoryClassId.ICID_TASKDICE;
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (TASKDICE_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = 0;
m_iShopPrice = 0;
m_iProcType = (int)m_pDBEssence.proc_type;
m_bUseable = true;
m_bNeedUpdate = false;
}
public EC_IvtrTaskDice(EC_IvtrTaskDice other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
return true;
}
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
protected override string GetNormalDesc(bool bRepair)
{
m_strDesc = "";
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
AddPriceDesc(white, bRepair);
// Extend description
AddExtDescText();
return m_strDesc;
}
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
}
}
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrTaskItem : EC_IvtrItem
{
protected TASKMATTER_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTaskItem(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_TASKITEM;
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (TASKMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = 0;
m_iShopPrice = 0;
m_iProcType = (int)m_pDBEssence.proc_type;
m_i64EquipMask = 0;
m_bNeedUpdate = false;
}
public EC_IvtrTaskItem(EC_IvtrTaskItem other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
return true;
}
// Get item icon file name
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
// Get item name
public override string GetName()
{
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
if (m_pDBEssence.name != null && m_pDBEssence.name.Length > 0)
{
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBEssence.name);
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
return s;
// Fallback to legacy CP936 if Unicode was empty
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
if (!string.IsNullOrEmpty(s))
return s;
}
return base.GetName(); // Fallback to base class method
}
// Get item description text
protected override string GetNormalDesc(bool bRepair)
{
m_strDesc = string.Empty;
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
// Task item
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_TASKITEM));
// Extend description
AddExtDescText();
return m_strDesc;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ec738837a1a3f40e38926d3365da3df5
@@ -1,20 +1,93 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using BrewMonster;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using UnityEngine;
using PerfectWorld.Scripts.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
/// <summary>
/// Task Normal Matter Item.(non interactable quest item). it is a part of IvtrTaskItem(C++)
/// </summary>
public class EC_IvtrTaskNmMatter : EC_IvtrItem
{
protected TASKNORMALMATTER_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Constructor for Task Normal Matter Item.
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTaskNmMatter(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_TASKNMMATTER;
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (TASKNORMALMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_iProcType = (int)m_pDBEssence.proc_type;
m_bNeedUpdate = false;
}
public EC_IvtrTaskNmMatter(EC_IvtrTaskNmMatter other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
return true;
}
// Get item icon file name
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
// Get item description text
protected override string GetNormalDesc(bool bRepair)
{
m_strDesc = string.Empty;
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
// Price
AddPriceDesc(white, bRepair);
// Extend description
AddExtDescText();
return m_strDesc;
}
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
}
}
@@ -1,20 +0,0 @@
using BrewMonster.Scripts.Managers;
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrTaskmatter : EC_IvtrItem
{
/// <summary>
/// Not create logic yet (add summary later)
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTaskmatter(int tid, int expire_date) : base(tid, expire_date)
{
}
public EC_IvtrTaskmatter(EC_IvtrTaskmatter other) : base(other)
{
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: ee5181c9a0786409fb452d21d947eab7
@@ -1,20 +1,95 @@
using BrewMonster;
using ModelRenderer.Scripts.GameData;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrTownscroll : EC_IvtrItem
/// <summary>
/// Town scroll item class (hoi thanh phu). It is a part of EC_IvtrScroll(c++)
/// TownScroll allow player to teleport to towns inside one map.
/// </summary>
public class EC_IvtrTownScroll : EC_IvtrItem
{
protected TOWNSCROLL_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Constructor for Town Scroll
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTownscroll(int tid, int expire_date) : base(tid, expire_date)
public EC_IvtrTownScroll(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_TOWNSCROLL;
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (TOWNSCROLL_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_iProcType = (int)m_pDBEssence.proc_type;
m_i64EquipMask = 0;
m_bUseable = true;
m_dwUseFlags = (uint)UseCondition.USE_PERSIST;
m_bNeedUpdate = false;
}
public EC_IvtrTownscroll(EC_IvtrTownscroll other) : base(other)
public EC_IvtrTownScroll(EC_IvtrTownScroll other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
return true;
}
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
// Get item cool time
public int GetCoolTime(ref int piMax)
{
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
return pHost ? pHost.GetCoolTime((int)CoolTimeIndex.GP_CT_TOWNSCROLL, ref piMax) : 0;
}
protected override string GetNormalDesc(bool bRepair)
{
m_strDesc = string.Empty;
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
// Price
AddPriceDesc(white, bRepair);
// Extend description
AddExtDescText();
return m_strDesc;
}
// Get drop model for shown
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
}
}
@@ -1,19 +1,104 @@
using BrewMonster;
using ModelRenderer.Scripts.GameData;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
using CSNetwork.GPDataType;
namespace PerfectWorld.Scripts.Managers
{
/// <summary>
/// Transmit scroll item(Da dich chuyen). It is a part of EC_IvtrConsume(c++)
/// TransmitScroll allow player to teleport to other maps' towns.
/// </summary>
public class EC_IvtrTransmitScroll : EC_IvtrItem
{
protected TRANSMITSCROLL_ESSENCE m_pDBEssence;
/// <summary>
/// Not create logic yet (add summary later)
/// Constructor for Transmit Scroll
/// </summary>
/// <param name="tid">Template id</param>
/// <param name="expire_date">Expire date</param>
public EC_IvtrTransmitScroll(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = (int)InventoryClassId.ICID_TRANSMITSCROLL;
// Get database data
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (TRANSMITSCROLL_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_iPileLimit = m_pDBEssence.pile_num_max;
m_iPrice = m_pDBEssence.price;
m_iShopPrice = m_pDBEssence.shop_price;
m_iProcType = (int)m_pDBEssence.proc_type;
m_i64EquipMask = 0;
m_bUseable = true;
m_dwUseFlags = (uint)UseCondition.USE_PERSIST;
m_bNeedUpdate = false;
}
public EC_IvtrTransmitScroll(EC_IvtrTransmitScroll other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
}
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
return true;
}
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
public int GetCoolTime(ref int piMax)
{
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
if (!pHost)
return 0;
int iTime = pHost.GetCoolTime((int)CoolTimeIndex.GP_CT_TOWNSCROLL, ref piMax);
return iTime;
}
protected override string GetNormalDesc(bool bRepair)
{
m_strDesc = string.Empty;
// Try to build item description
CECStringTab pDescTab = EC_Game.GetItemDesc();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int namecol = DecideNameCol();
if (m_iCount > 1)
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
else
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
AddIDDescText();
AddExpireTimeDesc();
// Price
AddPriceDesc(white, bRepair);
// Extend description
AddExtDescText();
return m_strDesc;
}
// Get drop model for shown
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
// Check item use condition
public override bool CheckUseCondition()
{
if( EC_Game.GetGameRun().GetHostPlayer().IsFighting() )
return false;
return true;
}
}
}
@@ -69,7 +69,6 @@ namespace BrewMonster.Scripts.Managers
public float attack_short_range;
public IVTR_ESSENCE_WEAPON( byte[] data)
{
Debug.Log("IVTR_ESSENCE_WEAPON: data.Length: " + data.Length);
CECDataReader dr = new (data, data.Length);
weapon_type = dr.ReadShort();
weapon_dealy = dr.ReadShort();
@@ -87,12 +86,20 @@ namespace BrewMonster.Scripts.Managers
};
public struct IVTR_ESSENCE_ARROW
{
// TODO : implement data later
// DWORD dwBowMask;
// int iDamage;
// int iDamageScale;
// int iWeaponReqLow;
// int iWeaponReqHigh;
public int dwBowMask;
public int iDamage;
public int iDamageScale;
public int iWeaponReqLow;
public int iWeaponReqHigh;
public IVTR_ESSENCE_ARROW(byte[] data)
{
CECDataReader dr = new (data, data.Length);
dwBowMask = dr.ReadInt();
iDamage = dr.ReadInt();
iDamageScale = dr.ReadInt();
iWeaponReqLow = dr.ReadInt();
iWeaponReqHigh = dr.ReadInt();
}
};
public struct IVTR_ESSENCE_DECORATION
{
@@ -103,7 +110,6 @@ namespace BrewMonster.Scripts.Managers
public int[] resistance;
public IVTR_ESSENCE_DECORATION(byte[] data)
{
Debug.Log("IVTR_ESSENCE_DECORATION: data.Length: " + data.Length);
CECDataReader dr = new (data, data.Length);
damage = dr.ReadInt();
magic_damage = dr.ReadInt();
@@ -141,23 +147,41 @@ namespace BrewMonster.Scripts.Managers
};
public struct IVTR_ESSENCE_FASHION
{
// TODO : implement data later
// int require_level;
// unsigned short color;
// unsigned short gender;
public int require_level;
public ushort color;
public ushort gender;
public IVTR_ESSENCE_FASHION(byte[] data)
{
CECDataReader dr = new (data, data.Length);
require_level = dr.ReadInt();
color = dr.ReadUShort();
gender = dr.ReadUShort();
}
};
public struct IVTR_ESSENCE_FLYSWORD
{
// TODO : implement data later
// int cur_time;
// int max_time;
// short require_level;
// char level;
// char improve_level;
// int profession;
// size_t time_per_element;
// float speed_increase;
// float speed_increase2;
public int cur_time;
public int max_time;
public short require_level;
public char level;
public char improve_level;
public int profession;
public int time_per_element;
public float speed_increase;
public float speed_increase2;
public IVTR_ESSENCE_FLYSWORD(byte[] data)
{
CECDataReader dr = new (data, data.Length);
cur_time = dr.ReadInt();
max_time = dr.ReadInt();
require_level = dr.ReadShort();
level = (char)dr.ReadByte();
improve_level = (char)dr.ReadByte();
profession = dr.ReadInt();
time_per_element = dr.ReadInt();
speed_increase = dr.ReadFloat();
speed_increase2 = dr.ReadFloat();
}
};
public struct IVTR_ESSENCE_WING
{
@@ -211,7 +211,6 @@ namespace PerfectWorld.Scripts.Managers
// Get item name
public override string GetName()
{
BMLogger.Log("[THN]EC_IvtrWeapon: GetName: m_pDBEssence.Name: " + m_pDBEssence.Name);
return m_pDBEssence.Name;
}
// Get preview info
@@ -81,6 +81,7 @@ namespace BrewMonster
protected int m_iBoothState = 0; // Booth state. 0, none; 1, prepare; 2, open booth; 3, visite other's booth
public int m_idFRole = GNETRoles._R_UNMEMBER; // ID of player's faction role
protected int m_idCountry = 0; // ¹úÕ½ÕóÓª id
public static int MAX_REINCARNATION = 2;
protected List<int> m_aCurEffects = new List<int>(); // Current effects
@@ -1891,4 +1892,56 @@ namespace BrewMonster
public static byte SKIN_FASHION_FOOT_INDEX = 9;
public static byte NUM_SKIN_INDEX = 10;
}
public enum enumSkinShow
{
enumSkinShowNone = 0,
enumSkinShowUpperBody,
enumSkinShowWrist,
enumSkinShowLowerBody,
enumSkinShowFoot,
enumSkinShowUpperAndLower,
enumSkinShowUpperAndWrist,
enumSkinShowLowerAndFoot,
enumSkinShowUpperLowerAndWrist,
enumSkinShowArmet,
enumSkinShowHand,
};
/// <summary>
/// Place holder for riding pet. Not test logic yet.
/// </summary>
public struct RIDINGPET
{
public int id;
public ushort color;
public RIDINGPET(bool isReset = true)
{
id = 0;
color = 0;
}
public bool GetColor(Color clr)
{
// ȡǰȾɫɫ
return id>0 && GetColor(color, clr);
}
public static bool GetColor(ushort c, Color clr)
{
// ѯǰǷȾɫȾɫرȾ֮ɫ
bool bRet = false;
if ((c & (1<<(8-1))) != 0)
{
// unsigned short λΪ1ʱʾȾɫʱɻȡɫ
clr = new Color(((c) & (0x1f << 10)) >> 7, ((c) & (0x1f << 5)) >> 2, ((c) & 0x1f) << 3);
bRet = true;
}
return bRet;
}
public static Color GetDefaultColor()
{
return new Color(255, 255, 255);
}
};
}
-56
View File
@@ -68,53 +68,6 @@ public class CECNPC : CECObject
m_pNPCModelPolicy = new CECNPCModelDefaultPolicy(this);
}
// Add this field to CECNPC class
private bool m_bHasRelatedTask = false;
private float _timerCheckTask = 0;
public void UpdateTaskIcon()
{
// Check if npcUI is assigned
if (m_npcUI == null)
{
m_npcUI = GetComponentInChildren<UINPC>();
if (m_npcUI == null) return;
}
// 2. Get Host Player & Interface
var host = CECGameRun.Instance.GetHostPlayer();
if (host == null) return;
var taskInterface = host.GetTaskInterface();
if (taskInterface == null)
{
if (m_bHasRelatedTask) // only update if state changed
{
m_npcUI.SetTaskIconMain(false);
m_bHasRelatedTask = false;
}
return;
}
// Get NPC Template ID
int npcTemplateID = m_NPCInfo.tid;
// Check if there are tasks related to this NPC
bool hasTask = taskInterface.HasTaskRelatedToNPC(npcTemplateID);
// Update icon only if state changed
if (m_bHasRelatedTask != hasTask)
{
m_bHasRelatedTask = hasTask;
m_npcUI.SetTaskIconMain(hasTask);
if (hasTask)
{
Debug.Log($"[Icon] NPC {m_strName} (TID: {npcTemplateID})");
}
}
}
public string GetName()
{
@@ -226,8 +179,6 @@ public class CECNPC : CECObject
new Vector2(m_vServerPos.x, m_vServerPos.z),
new Vector2(pHost.transform.position.x, pHost.transform.position.z));
}
UpdateTaskIcon();
return true;
}
@@ -561,13 +512,6 @@ public class CECNPC : CECObject
{
StartAdjustTransparency(-1.0f, GetTransparentLimit(), 500);
}
_timerCheckTask += Time.deltaTime;
if (_timerCheckTask > 1.0f)
{
_timerCheckTask = 0;
UpdateTaskIcon();
}
}
private void TickWork_Dead(float deltaTime)
+238 -3
View File
@@ -1,4 +1,7 @@
using BrewMonster;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Task;
using CSNetwork.GPDataType;
using System;
using System.Runtime.InteropServices;
@@ -10,12 +13,17 @@ public class CECNPCServer : CECNPC
{
NPC_ESSENCE? m_pDBEssence;
MONSTER_ESSENCE? m_pMonEssence;
float m_fTaxRate = 0.05f; // Tax rate
float m_fTaxRate = 0.05f; // Tax rate
private IconTaskType m_TaskIcon = IconTaskType.QI_NONE;
private CECCounter m_TaskCounter = new CECCounter();
public override void SetUpCECNPC(CECNPCMan pNPCMan)
{
base.SetUpCECNPC(pNPCMan);
m_iCID = (int)Class_ID.OCID_SERVER;
m_pDBEssence = null;
m_TaskCounter.SetPeriod(1000);
}
public override bool Init(int tid, in info_npc info, ReadOnlySpan<byte> packet, int infoOffset)
{
@@ -57,11 +65,20 @@ public class CECNPCServer : CECNPC
transform.position = EC_Utility.ToVector3(info.pos);
StartWork((int)WorkType.WT_NOTHING, (int)WorkID.WORK_STAND);
UpdateTaskIcon();
return true;
}
protected override void Update()
{
base.Update();
if (m_TaskCounter.IncCounter(Time.deltaTime * 1000))
{
m_TaskCounter.Reset();
UpdateCurTaskIcon();
}
}
// Get way point ID bound with this NPC
public uint? GetWayPointID()
{
@@ -83,4 +100,222 @@ public class CECNPCServer : CECNPC
{
return 1.0f + m_pDBEssence.Value.tax_rate;
}
private void UpdateCurTaskIcon()
{
var pHost = CECGameRun.Instance.GetHostPlayer();
if (pHost == null || pHost.GetTaskInterface() == null)
{
return;
}
if (m_pDBEssence == null)
{
return;
}
var pTaskMan = EC_Game.GetTaskTemplateMan();
var pDataMan = ElementDataManProvider.GetElementDataMan();
var pTask = pHost.GetTaskInterface();
const uint TASK_HAVE_COMPLETE = 0x10000000;
const uint TASK_COMPLETE = 0x01;
const uint TASK_INCOMPLETE = 0x02;
const uint TASK_CANGET = 0x04;
const uint TASK_CANNOTGET = 0x08;
const uint TASK_COMPLETE_TYPE1 = 0x10;
const uint TASK_CANGET_TYPE1 = 0x20;
const uint TASK_COMPLETE_TYPE2 = 0x40;
const uint TASK_CANGET_TYPE2 = 0x80;
const uint TASK_COMPLETE_TYPE3 = 0x100;
const uint TASK_CANGET_TYPE3 = 0x200;
const uint TASK_COMPLETE_TYPE4 = 0x400;
const uint TASK_CANGET_TYPE4 = 0x800;
m_TaskIcon = IconTaskType.QI_NONE;
uint taskFlag = 0;
BMLogger.Log($"[UpdateCurTaskIcon] NPC {m_NPCInfo.nid}, id_task_in_service={m_pDBEssence.Value.id_task_in_service}, id_task_out_service={m_pDBEssence.Value.id_task_out_service}");
if (m_pDBEssence.Value.id_task_in_service != 0)
{
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
var serviceData = pDataMan.get_data_ptr(m_pDBEssence.Value.id_task_in_service, ID_SPACE.ID_SPACE_ESSENCE, ref dt);
if (serviceData != null && dt == DATA_TYPE.DT_NPC_TASK_IN_SERVICE)
{
var inService = (NPC_TASK_IN_SERVICE)serviceData;
for (int i = 0; i < inService.id_tasks.Length; i++)
{
uint idTask = inService.id_tasks[i];
if (idTask <= 0 || !pTask.HasTask(idTask))
continue;
BMLogger.Log($"[UpdateCurTaskIcon] Check IN task {idTask}, HasTask={pTask.HasTask(idTask)}, CanFinish={pTask.CanFinishTask((idTask))}");
var pTaskTemp = pTaskMan.GetTaskTemplByID(idTask);
if (pTaskTemp == null)
continue;
if (pTask.CanFinishTask(idTask))
{
taskFlag |= TASK_HAVE_COMPLETE;
if (pTaskTemp.IsKeyTask())
{
m_TaskIcon = IconTaskType.QI_IN_K;
BMLogger.Log($"[UpdateCurTaskIcon] Set icon QI_IN_K for task {idTask}");
UpdateTaskIconUI();
return;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTEvent || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTDaily)
{
taskFlag |= TASK_COMPLETE_TYPE3;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTQiShaList)
{
taskFlag |= TASK_COMPLETE_TYPE2;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTFaction || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTFunction)
{
taskFlag |= TASK_COMPLETE_TYPE1;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTMajor)
{
taskFlag |= TASK_COMPLETE_TYPE4;
}
else
{
taskFlag |= TASK_COMPLETE;
}
}
else
{
taskFlag |= TASK_INCOMPLETE;
}
}
}
}
if ((taskFlag & TASK_HAVE_COMPLETE) != 0)
{
if ((taskFlag & TASK_COMPLETE_TYPE4) != 0)
m_TaskIcon = IconTaskType.QI_IN_TYPE4;
else if ((taskFlag & TASK_COMPLETE_TYPE3) != 0)
m_TaskIcon = IconTaskType.QI_IN_TYPE3;
else if ((taskFlag & TASK_COMPLETE_TYPE2) != 0)
m_TaskIcon = IconTaskType.QI_IN_TYPE2;
else if ((taskFlag & TASK_COMPLETE) != 0)
m_TaskIcon = IconTaskType.QI_IN;
else if ((taskFlag & TASK_COMPLETE_TYPE1) != 0)
m_TaskIcon = IconTaskType.QI_IN_TYPE1;
BMLogger.Log($"[UpdateCurTaskIcon] Set complete icon {m_TaskIcon}");
UpdateTaskIconUI();
return;
}
if (m_pDBEssence.Value.id_task_out_service != 0)
{
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
var serviceData = pDataMan.get_data_ptr(
m_pDBEssence.Value.id_task_out_service,
ID_SPACE.ID_SPACE_ESSENCE,
ref dt
);
if (serviceData != null && dt == DATA_TYPE.DT_NPC_TASK_OUT_SERVICE)
{
var outService = (NPC_TASK_OUT_SERVICE)serviceData;
if (outService.storage_id != 0 && outService.storage_open_item != 0)
{
var pack = pHost.GetInventory(InventoryConst.IVTRTYPE_PACK);
if (pack != null && pack.GetItemTotalNum((int)outService.storage_open_item) > 0)
{
taskFlag |= TASK_CANGET_TYPE2;
}
}
// Check normal tasks
for (int i = 0; i < outService.id_tasks.Length; i++)
{
uint idTask = outService.id_tasks[i];
if (idTask <= 0)
continue;
BMLogger.Log($"[UpdateCurTaskIcon] Check OUT task {idTask}, CanShow={pTask.CanShowTask(idTask)}, CanDeliver={pTask.CanDeliverTask(idTask)}");
if (!pTask.CanShowTask(idTask))
continue;
var pTaskTemp = pTaskMan.GetTaskTemplByID(idTask);
if (pTaskTemp == null)
continue;
if (pTask.CanDeliverTask(idTask) == 0)
{
if (pTaskTemp.IsKeyTask())
{
m_TaskIcon = IconTaskType.QI_OUT_K;
BMLogger.Log($"[UpdateCurTaskIcon] Set icon QI_OUT_K for task {idTask}");
UpdateTaskIconUI();
return;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTEvent || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTDaily)
{
taskFlag |= TASK_CANGET_TYPE3;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTQiShaList)
{
taskFlag |= TASK_CANGET_TYPE2;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTFaction || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTFunction)
{
taskFlag |= TASK_CANGET_TYPE1;
}
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTMajor)
{
taskFlag |= TASK_CANGET_TYPE4;
}
else
{
taskFlag |= TASK_CANGET;
}
}
else
{
taskFlag |= TASK_CANNOTGET;
}
}
}
}
// Set icon by available task priority
if ((taskFlag & TASK_CANGET_TYPE4) != 0)
m_TaskIcon = IconTaskType.QI_OUT_TYPE4;
else if ((taskFlag & TASK_CANGET_TYPE3) != 0)
m_TaskIcon = IconTaskType.QI_OUT_TYPE3;
else if ((taskFlag & TASK_CANGET_TYPE2) != 0)
m_TaskIcon = IconTaskType.QI_OUT_TYPE2;
else if ((taskFlag & TASK_CANGET) != 0)
m_TaskIcon = IconTaskType.QI_OUT;
else if ((taskFlag & TASK_CANGET_TYPE1) != 0)
m_TaskIcon = IconTaskType.QI_OUT_TYPE1;
else if ((taskFlag & TASK_INCOMPLETE) != 0)
m_TaskIcon = IconTaskType.QI_IN_N;
else if ((taskFlag & TASK_CANNOTGET) != 0)
m_TaskIcon = IconTaskType.QI_OUT_N;
BMLogger.Log($"[UpdateCurTaskIcon] Final icon {m_TaskIcon}, taskFlag={taskFlag}");
UpdateTaskIconUI();
}
private void UpdateTaskIconUI()
{
if(m_npcUI != null)
{
m_npcUI.SetTaskIcon(m_TaskIcon);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,23 +1,27 @@
using System;
using System.Collections.Generic;
using CSNetwork.Protocols.RPCData;
namespace CSNetwork.Protocols
{
public class createrole : Protocol
{
public int Userid { get; set; }
public int Localsid { get; set; }
public uint Localsid { get; set; }
public RoleInfo Roleinfo { get; set; }
public Octets Referid { get; set; }
public createrole() : base(ProtocolType.PROTOCOL_CREATEROLE)
{
Referid = new Octets();
Roleinfo = new RoleInfo();
}
public override Protocol Clone() => new createrole
{
Userid = Userid,
Localsid = Localsid,
Roleinfo = Roleinfo?.Clone(),
Referid = new Octets(Referid.ToArray())
};
@@ -25,13 +29,23 @@ namespace CSNetwork.Protocols
{
os.Write(Userid);
os.Write(Localsid);
if (Roleinfo != null)
{
Roleinfo.Marshal(os);
}
else
{
new RoleInfo().Marshal(os);
}
os.Write(Referid);
}
public override void Unmarshal(OctetsStream os)
{
Userid = os.ReadInt32();
Localsid = os.ReadInt32();
Localsid = os.ReadUInt32();
Roleinfo = new RoleInfo();
Roleinfo.Unmarshal(os);
Referid = os.ReadOctets();
}
@@ -0,0 +1,58 @@
using System;
using CSNetwork.Protocols.RPCData;
namespace CSNetwork.Protocols
{
public class createrole_re : Protocol
{
public int result { get; set; }
public int roleid { get; set; }
public uint localsid { get; set; }
public RoleInfo roleinfo { get; set; }
public int refretcode { get; set; }
public createrole_re() : base(ProtocolType.PROTOCOL_CREATEROLE_RE)
{
roleinfo = new RoleInfo();
}
public override Protocol Clone() => new createrole_re
{
result = result,
roleid = roleid,
localsid = localsid,
roleinfo = roleinfo?.Clone(),
refretcode = refretcode
};
public override void Marshal(OctetsStream os)
{
os.Write(result);
os.Write(roleid);
os.Write(localsid);
if (roleinfo != null)
{
roleinfo.Marshal(os);
}
else
{
new RoleInfo().Marshal(os);
}
os.Write(refretcode);
}
public override void Unmarshal(OctetsStream os)
{
result = os.ReadInt32();
roleid = os.ReadInt32();
localsid = os.ReadUInt32();
roleinfo = new RoleInfo();
roleinfo.Unmarshal(os);
refretcode = os.ReadInt32();
}
public override int PriorPolicy() => 101;
public override bool SizePolicy(int size) => size <= 8192;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3640555d366b4e34bbefbbf040f7f339
@@ -35,7 +35,8 @@ namespace CSNetwork.Protocols.RPCData
os.Write(pos);
os.Write(count);
os.Write(max_count);
os.Write(data);
// Server-side expects an Octets field here; null will crash encoding.
os.Write(data ?? new Octets());
os.Write(proctype);
os.Write(expire_date);
os.Write(guid1);
@@ -69,9 +69,10 @@ namespace CSNetwork.Protocols.RPCData
os.Write(occupation);
os.Write(level);
os.Write(level2);
os.Write(name);
os.Write(custom_data);
os.WriteList(equipment);
// Avoid null Octets/List crashing protocol.Encode()
os.Write(name ?? new Octets());
os.Write(custom_data ?? new Octets());
os.WriteList(equipment ?? new List<GRoleInventory>());
os.Write(status);
os.Write(delete_time);
os.Write(create_time);
@@ -80,12 +81,12 @@ namespace CSNetwork.Protocols.RPCData
os.Write(posy);
os.Write(posz);
os.Write(worldtag);
os.Write(custom_status);
os.Write(charactermode);
os.Write(custom_status ?? new Octets());
os.Write(charactermode ?? new Octets());
os.Write(referrer_role);
os.Write(cash_add);
os.Write(reincarnation_data);
os.Write(realm_data);
os.Write(reincarnation_data ?? new Octets());
os.Write(realm_data ?? new Octets());
}
public void Unmarshal(OctetsStream os)
@@ -1,4 +1,4 @@
using BrewMonster;
using BrewMonster;
using BrewMonster.Common;
using CSNetwork;
using CSNetwork.C2SCommand;
@@ -171,6 +171,12 @@ namespace BrewMonster.Network
{
Instance._gameSession.SelectRoleAsync(roleInfo, callback);
}
public static void CreateRoleAsync(RoleInfo roleInfo, Octets referId, Action<RoleInfo> callback = null)
{
Instance._gameSession.CreateRoleAsync(roleInfo, referId, callback);
}
public static void EnterWorldAsync(RoleInfo roleInfo, Action callback = null)
{
Debug.Log("EnterWorldAsync !!!!! nay ");
@@ -300,96 +300,28 @@ namespace BrewMonster.Scripts.Task
return tasks;
}
// Add this method to ATaskTemplMan class if not exists
public List<ATaskTempl> GetAllTopTasks()
public int GetStorageRefreshPerDay(uint storageId)
{
List<ATaskTempl> topTasks = new List<ATaskTempl>();
if (storageId == 0 || storageId > TaskInterfaceConstants.TASK_STORAGE_COUNT)
return 0;
// Iterate through all task templates and collect top-level tasks
// Assuming you have a dictionary or collection of all tasks
foreach (var kvp in m_TaskTemplMap) // Replace with your actual collection name
if (!m_StorageEssenseMap.TryGetValue(storageId, out uint essenceId))
return 0;
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
var serviceData = m_pEleDataMan.get_data_ptr(
essenceId,
ID_SPACE.ID_SPACE_ESSENCE,
ref dt
);
if (serviceData != null && dt == DATA_TYPE.DT_NPC_TASK_OUT_SERVICE)
{
var templ = kvp.Value;
if (templ != null && templ.m_pParent == null) // Top-level task has no parent
{
topTasks.Add(templ);
}
var outService = (NPC_TASK_OUT_SERVICE)serviceData;
return (int)outService.storage_refresh_per_day;
}
return topTasks;
}
// Alternative method if you want to check by NPC ID directly
public List<ATaskTempl> GetAvailableTasksForNPC(int npcID)
{
List<ATaskTempl> availableTasks = new List<ATaskTempl>();
foreach (var kvp in m_TaskTemplMap) // Replace with your actual collection name
{
var templ = kvp.Value;
if (templ != null &&
templ.m_pParent == null &&
templ.m_FixedData.m_ulDelvNPC == npcID)
{
availableTasks.Add(templ);
}
}
return availableTasks;
}
// Add this method to ATaskTemplMan class
/// <summary>
/// Get all task templates (for iterating to find available tasks)
/// Lấy tất cả task templates (để duyệt tìm nhiệm vụ có thể nhận)
/// </summary>
public List<ATaskTempl> GetAllTaskTemplates()
{
List<ATaskTempl> allTasks = new List<ATaskTempl>();
// Assuming you have a collection storing all task templates
// Replace m_TaskMap with your actual collection name
if (m_TaskTemplMap != null)
{
foreach (var kvp in m_TaskTemplMap)
{
if (kvp.Value != null)
{
allTasks.Add(kvp.Value);
}
}
}
return allTasks;
}
/// <summary>
/// Get list of tasks delivered by a specific NPC
/// </summary>
public List<ATaskTempl> GetTasksFromNPC(int npcID)
{
var result = new List<ATaskTempl>();
// Check if NPC info map is available
if (m_NPCInfoMap != null && m_NPCInfoMap.TryGetValue((uint)npcID, out var npcInfo))
{
return new List<ATaskTempl>();
}
else
{
// Fallback
foreach (var kvp in m_TaskTemplMap)
{
var templ = kvp.Value;
if (templ != null && templ.m_FixedData.m_ulDelvNPC == npcID)
{
result.Add(templ);
}
}
}
return result;
return 0;
}
// General method to read a struct from a FileStream
@@ -531,85 +531,6 @@ namespace BrewMonster.Scripts.Task
return m_pActiveListBuf;
}
// Trong file CECTaskInterface.cs
public bool HasTaskRelatedToNPC(int npcID)
{
// Check tasks is active
ActiveTaskList activeList = GetActiveTaskList();
if (activeList != null && activeList.m_TaskEntries != null)
{
for (int i = 0; i < activeList.m_uTaskCount; i++)
{
var entry = activeList.m_TaskEntries[i];
if (entry == null) continue;
ATaskTempl templ = entry.GetTempl();
if (templ == null) continue;
// Check if this NPC is the target of the task
if (IsNPCTargetOfTask(templ, entry, npcID))
{
return true;
}
}
}
// Check tasks new
ATaskTemplMan taskMan = GetTaskTemplMan();
if (taskMan != null)
{
List<ATaskTempl> npcTasks = taskMan.GetTasksFromNPC(npcID);
if (npcTasks != null)
{
uint ulCurTime = GetCurTime();
foreach (var templ in npcTasks)
{
// Check prerequisite
if (templ.CheckPrerequisite(this, activeList, ulCurTime) == 0)
{
return true;
}
}
}
}
return false;
}
// Check NPC is target of the task
private bool IsNPCTargetOfTask(ATaskTempl templ, ActiveTaskEntry entry, int npcID)
{
var data = templ.m_FixedData;
// Task completed case
if (entry.IsFinished())
{
if (data.m_ulAwardNPC == npcID) return true;
}
else
{
// NPC target
if (data.m_ulNPCMoving == npcID) return true;
// Pos target
if (data.m_ulNPCDestSite == npcID) return true;
// Security target
if (data.m_ulNPCToProtect == npcID) return true;
if (data.m_enumMethod == (ulong)TaskCompletionMethod.enumTMTalkToNPC)
{
if (data.m_ulNPCMoving == 0 && data.m_ulAwardNPC == npcID)
{
return true;
}
}
}
return false;
}
// private void InitActiveTaskList()
// {
// ActiveTaskList pLst = GetActiveTaskList();
+38 -13
View File
@@ -193,8 +193,7 @@ namespace BrewMonster.Scripts.Task.UI
});
trigger.triggers.Add(entry);
UnityEngine.Debug.Log($"[DlgTask] Awake: Added EventTrigger for PointerClick to m_pTxt_QuestItem (like C++ WM_LBUTTONDOWN)");
}
}
OnInitDialog();
}
@@ -484,6 +483,7 @@ namespace BrewMonster.Scripts.Task.UI
if (pTempl == null) return string.Empty;
var type = (ENUM_TASK_TYPE)pTempl.m_FixedData.m_ulType;
string rawName = ModelRenderer.Scripts.Common.ByteToStringUtils.UshortArrayToUnicodeString(pTempl.m_FixedData.m_szName);
if (type == ENUM_TASK_TYPE.enumTTQiShaList && !string.IsNullOrEmpty(rawName) && rawName[0] == '^')
{
// 如果是七杀榜任务且已经加了颜色,则颜色不变 // If QiShaList task already has color, keep it
@@ -493,6 +493,25 @@ namespace BrewMonster.Scripts.Task.UI
string strColorPreFix = A3DColorToString(GetTaskColor(pTempl));
return strColorPreFix + strTaskName;
}
private string GetTaskNameWithColor(ATaskTempl pTempl, out Color color)
{
if (pTempl == null) {
color = Color.white;
return string.Empty;
}
var type = (ENUM_TASK_TYPE)pTempl.m_FixedData.m_ulType;
string rawName = ModelRenderer.Scripts.Common.ByteToStringUtils.UshortArrayToUnicodeString(pTempl.m_FixedData.m_szName);
if (type == ENUM_TASK_TYPE.enumTTQiShaList && !string.IsNullOrEmpty(rawName) && rawName[0] == '^')
{
// 如果是七杀榜任务且已经加了颜色,则颜色不变 // If QiShaList task already has color, keep it
color = GetTaskColor(pTempl);
return rawName;
}
string strTaskName = GetTaskNameWithOutColor(pTempl);
color = GetTaskColor(pTempl);
return strTaskName;
}
// static ACString GetTaskNameWithOutColor(const ATaskTempl* pTempl);
private static string GetTaskNameWithOutColor(ATaskTempl pTempl)
{
@@ -520,6 +539,7 @@ namespace BrewMonster.Scripts.Task.UI
}
Color result;
EC_Utility.STRING_TO_A3DCOLOR(GetStringFromTable(idType - (int)ENUM_TASK_TYPE.enumTTDaily + 3121), out result);
Debug.Log("[DlgTask] GetTaskColor result : " + result);
return result;
// return UnityEngine.Color.white;
}
@@ -684,7 +704,6 @@ namespace BrewMonster.Scripts.Task.UI
if( idTask != m_idLastTask )
{
_nameTaskText.SetText(EC_Utility.FormatForTextMeshPro(GetTaskNameWithColor(pTemp)));
//pTextDesc->SetText(FormatTaskText(pTemp->GetDescription(), pTextDesc->GetColor()));
pTextDesc.SetText(EC_Utility.FormatForTextMeshPro(pTemp.GetDescription()));
m_idLastTask = idTask;
@@ -800,7 +819,7 @@ namespace BrewMonster.Scripts.Task.UI
if (idTask != m_idLastTask)
{
_nameTaskText.SetText(EC_Utility.FormatForTextMeshPro(GetTaskNameWithColor(pTemp)));
Debug.Log("[DlgTask] SearchForTask name task: " + _nameTaskText.text);
if (pTextDesc != null) pTextDesc.SetText(EC_Utility.FormatForTextMeshPro(pTemp.GetDescription()));
m_idLastTask = idTask;
bLastTaskChanged = true;
@@ -1049,8 +1068,10 @@ namespace BrewMonster.Scripts.Task.UI
while (child != null)
{
uint id = child.m_FixedData.m_ID;
string text = GetTaskNameWithColor(child);
Color disPlayColor=Color.white;
string text = GetTaskNameWithColor(child,out disPlayColor);
var pItem = pTreeTask.InsertItem(text, pRoot, null);
pItem.SetItemTextColor(disPlayColor);
if (pItem != null)
{
pTreeTask.SetItemData(pItem, id);
@@ -1065,6 +1086,7 @@ namespace BrewMonster.Scripts.Task.UI
InsertTaskChildren(pItem, id, bExpand, bKey);
child = child.m_pNextSibling;
}
}
// [中文] 仅插入“已接任务(Active)”中的子任务(基于 ActiveTaskList 的 Child/NextSbl 索引)
@@ -1093,9 +1115,11 @@ namespace BrewMonster.Scripts.Task.UI
uint childId = childEntry.m_ID;
ATaskTempl childTempl = pMan.GetTaskTemplByID(childId);
string text = childTempl != null ? GetTaskNameWithColor(childTempl) : $"Task {childId}";
Color disPlayColor=Color.white;
string text = childTempl != null ? GetTaskNameWithColor(childTempl,out disPlayColor) : $"Task {childId}";
Debug.Log("[DlgTask] InsertActiveTaskChildren text: " + text);
var pItem = pTreeTask.InsertItem(text, pRoot, null);
pItem.SetItemTextColor(disPlayColor);
if (pItem != null)
{
pTreeTask.SetItemData(pItem, childId);
@@ -1742,10 +1766,12 @@ namespace BrewMonster.Scripts.Task.UI
}
// add Biggest node if not exist
string strItem = GetTaskNameWithColor(pTemp, out Color color);
if(pParent ==null)
{
pParent = pTreeTask.InsertItem(GetStringFromTable(3101 + nTaskType - 100), null, pAfter);
// TODO: Expand tree node
pParent.SetItemTextColor(color);
// TODO: Expand tree node
// pTreeTask.Expand(pParent, AUITREEVIEW_EXPAND_EXPAND);
pTreeTask.SetItemData(pParent, nTaskType);
@@ -1755,17 +1781,16 @@ namespace BrewMonster.Scripts.Task.UI
CECTaskInterface pTask = GetHostPlayer()?.GetTaskInterface();
if (pTask == null) return;
string strItem = GetTaskNameWithColor(pTemp);
bool bTaskPushed = pMan.IsTaskToPush(id) && !pTask.HasTask((uint)id);
if (bTaskPushed) {
strItem += GetStringFromTable(3100);
}
pItem = pTreeTask.InsertItem(strItem, pParent, null);
if( pTemp.IsKeyTask() )
// pTreeTask.SetItemTextColor(pItem, GetTaskColor((int)ENUM_TASK_TYPE.enumTTLevel2));
pItem.SetItemTextColor(color);
if( pTemp.IsKeyTask() )
{
pItem.SetItemTextColor(GetTaskColor((int)ENUM_TASK_TYPE.enumTTLevel2));
// pTreeTask.SetItemHint(pItem, pTemp->GetSignature()); // TODO
}
pTreeTask.SetItemData(pItem, (uint)id);
// HaveQuest view: children should reflect ActiveTaskList, not template tree (otherwise they never disappear on completion)
if (m_iType == 0)
@@ -53,6 +53,11 @@ namespace BrewMonster.Scripts.Task.UI
{
// Create a new item GameObject and component
TaskTreeViewItem pItem = Instantiate(m_pTreeViewItemPrefab);
if(pParent != null)
{
pParent.SetLastItem(false);
}
pItem.SetLastItem(true);
GameObject go = pItem.gameObject;
// go.name = $"Task_{}";
if (pItem == null) return null;
@@ -4,22 +4,22 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using BrewMonster.Scripts.UI;
namespace BrewMonster.Scripts.Task.UI
{
public class TaskTreeViewItem : MonoBehaviour, IRefreshLayout
{
[SerializeField] private TMP_Text m_text;
[SerializeField] private TextOutlet m_text;
[SerializeField] private Button m_Button;
[SerializeField] private Sprite[] _levelSprites;
[SerializeField] private Button _expandButton;
[SerializeField] private Button _collapseButton;
[SerializeField] private Toggle _expandToggle;
[SerializeField] private TextOutlet _expandText;
[SerializeField] private LayoutElement _space;
[Header("DEBUG")]
[SerializeField] private uint m_uItemData;
[SerializeField] private int _treeLevel;
private RectTransform _rectTransform;
public bool isLastItem = true;
public UnityEvent<uint> OnClick = new UnityEvent<uint>();
#region UNITY_METHODS
@@ -27,10 +27,10 @@ namespace BrewMonster.Scripts.Task.UI
private void Awake()
{
m_Button.onClick.AddListener(OnBtnClick);
_expandButton.onClick.AddListener(OnExpandBtnClicked);
_collapseButton.onClick.AddListener(OnCollapseBtnClicked);
_expandButton.gameObject.SetActive(false);
_collapseButton.gameObject.SetActive(false);
//_expandButton.onClick.AddListener(OnExpandBtnClicked);
//_collapseButton.onClick.AddListener(OnCollapseBtnClicked);
// _expandButton.gameObject.SetActive(false);
// _collapseButton.gameObject.SetActive(false);
_rectTransform = GetComponent<RectTransform>();
}
@@ -66,24 +66,36 @@ namespace BrewMonster.Scripts.Task.UI
if (m_text != null)
{
m_text.color = color;
m_text.SetColor(color);
_expandText.SetColor(color);
}
}
public void SetLastItem(bool isLastItem)
{
this.isLastItem = isLastItem;
if(isLastItem)
{
_expandText.Set("●"); // thís not show in tmp text
_expandToggle.onValueChanged.RemoveAllListeners();
}
else
{
_expandText.Set("+");
_expandToggle.onValueChanged.AddListener(OnExpandToggleValueChanged);
}
}
public void SetItemText(string text)
{
if (m_text != null)
{
m_text.text = text;
m_text.Set(text);
}
}
public void SetTreeLevel(int level)
{
_treeLevel = level;
Image btnImage = m_Button.GetComponent<Image>();
btnImage.sprite = _treeLevel < _levelSprites.Length ? _levelSprites[_treeLevel] : _levelSprites[^1];
btnImage.SetNativeSize();
_space.preferredWidth = level * 40;
}
public int GetTreeLevel() => _treeLevel;
@@ -98,8 +110,8 @@ namespace BrewMonster.Scripts.Task.UI
children[i].gameObject.SetActive(expand);
}
_expandButton.gameObject.SetActive(!expand);
_collapseButton.gameObject.SetActive(expand);
//_expandButton.gameObject.SetActive(!expand);
//_collapseButton.gameObject.SetActive(expand);
RefreshLayout();
}
@@ -147,6 +159,19 @@ namespace BrewMonster.Scripts.Task.UI
{
SetExpand(false);
}
void OnExpandToggleValueChanged(bool isOn)
{
SetExpand(isOn);
if(isOn)
{
_expandText.Set("-");
}
else
{
_expandText.Set("+");
}
}
}
public struct TaskItemClickEvent
@@ -5,6 +5,27 @@ using UnityEngine.UI;
namespace BrewMonster
{
public enum IconTaskType
{
QI_NONE = -1,
QI_OUT = 2, // task tu chan (nhan)
QI_IN = 2, // task tu chan (hoan thanh)
QI_OUT_N = 3, // chua du dieu kien nhan task
QI_IN_N = 3, // task nhan nhung chua lam (chua xong)
QI_OUT_K = 0, // chua biet
QI_IN_K = 5, // chua biet
QI_OUT_TYPE1 = 5, // task bang hoi (nhan)
QI_IN_TYPE1 = 5, // task bang hoi (hoan thanh)
QI_OUT_TYPE2 = 1, // chua biet
QI_IN_TYPE2 = 1, // chua biet
QI_OUT_TYPE3 = -1, // task daily (nhan)
QI_IN_TYPE3 = -1, // task daily (hoan thanh)
QI_OUT_TYPE4 = 0, // task chinh (nhan)
QI_IN_TYPE4 = 4, // task chinh (hoan thanh)
}
public class UINPC : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI _nameText;
@@ -13,6 +34,21 @@ namespace BrewMonster
[Header("List Icon Task")]
[SerializeField] private GameObject _iconTaskMain;
[SerializeField] private List<Sprite> _listIconTask;
private Image _cachedIconImage;
private void Awake()
{
if (_iconTaskMain != null)
{
_cachedIconImage = _iconTaskMain.GetComponent<Image>();
if (_cachedIconImage == null)
{
BMLogger.LogError($"[UINPC] _iconTaskMain doesn't have Image component!");
}
}
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
public void SetName(string name)
@@ -30,10 +66,30 @@ namespace BrewMonster
_healthText.text = healthText;
}
public void SetTaskIcon(IconTaskType iconType)
{
if (_iconTaskMain == null || _cachedIconImage == null)
{
return;
}
int iconIndex = (int)iconType;
if (iconIndex >= 0 && _listIconTask != null && iconIndex < _listIconTask.Count)
{
_cachedIconImage.sprite = _listIconTask[iconIndex];
_iconTaskMain.SetActive(true);
}
else
{
_iconTaskMain.SetActive(false);
}
}
public void SetTaskIconMain(bool isShow)
{
if(_iconTaskMain != null)
if (_iconTaskMain != null)
_iconTaskMain.SetActive(isShow);
}
}
}
@@ -0,0 +1,249 @@
using System;
using System.Text;
using BrewMonster.Network;
using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using BrewMonster.Scripts;
namespace BrewMonster.UI
{
/// <summary>
/// UI screen for creating a new character.
/// Equivalent to CDlgCreateGenderName + CDlgCreateProfession in C++.
/// </summary>
public class CreateCharacterScreen : MonoBehaviour
{
[SerializeField] private GameObject professionSelectionPanel;
[SerializeField] private Button[] professionButtons;
[SerializeField] private Button maleGenderButton;
[SerializeField] private Button femaleGenderButton;
[SerializeField] private TMP_InputField nameInputField;
[SerializeField] private Button confirmButton;
[SerializeField] private Button cancelButton;
[SerializeField] private Button backButton;
private int _currentProfession = -1;
private int _currentGender = -1;
private Action<RoleInfo> _onCreateComplete;
private Action _onCancel;
// Static array matching s_bShowMale[NUM_PROFESSION] from original C++ code (EC_ProfConfigs.cpp)
// true = show male, false = show female
private static readonly bool[] s_bShowMale = new bool[]
{
true, // 0: Warrior (武侠)
false, // 1: Mage (法师)
false, // 2: Priest (巫师)
false, // 3: Assassin (妖精)
true, // 4: Orc (妖兽)
true, // 5: Monk (刺客)
true, // 6: Elf (羽芒)
false, // 7: Elf (羽灵)
true, // 8: Ling (剑灵)
false, // 9: Ling (魅灵)
true, // 10: Oboro (夜影)
false, // 11: Oboro (月仙)
};
private void Start()
{
if (confirmButton != null)
confirmButton.onClick.AddListener(OnConfirmClicked);
if (cancelButton != null)
cancelButton.onClick.AddListener(OnCancelClicked);
if (backButton != null)
backButton.onClick.AddListener(OnCancelClicked);
if (maleGenderButton != null)
maleGenderButton.onClick.AddListener(() => OnGenderSelected(GENDER.GENDER_MALE));
if (femaleGenderButton != null)
femaleGenderButton.onClick.AddListener(() => OnGenderSelected(GENDER.GENDER_FEMALE));
// Setup profession buttons
if (professionButtons != null)
{
for (int i = 0; i < professionButtons.Length && i < 12; i++)
{
int prof = i; // Capture for closure
if (professionButtons[i] != null)
professionButtons[i].onClick.AddListener(() => OnProfessionSelected(prof));
}
}
if (nameInputField != null)
{
nameInputField.onSubmit.AddListener((text) => { if (CanConfirm()) OnConfirmClicked(); });
}
}
public void Show(Action<RoleInfo> onCreateComplete, Action onCancel)
{
_onCreateComplete = onCreateComplete;
_onCancel = onCancel;
_currentProfession = -1;
_currentGender = -1;
gameObject.SetActive(true);
if (nameInputField != null)
{
nameInputField.text = "";
nameInputField.Select();
}
UpdateConfirmButtonState();
}
public void Hide()
{
gameObject.SetActive(false);
}
private void OnProfessionSelected(int profession)
{
if (profession < 0 || profession >= (int)Profession.NUM_PROFESSION)
return;
_currentProfession = profession;
// Update UI to show selected profession
if (professionButtons != null)
{
for (int i = 0; i < professionButtons.Length; i++)
{
if (professionButtons[i] != null)
{
// Visual feedback for selected profession
var colors = professionButtons[i].colors;
colors.normalColor = (i == profession) ? Color.yellow : Color.white;
professionButtons[i].colors = colors;
}
}
}
// Auto-select gender based on profession (matching original C++ logic from EC_ProfConfigs.cpp)
// This matches the s_bShowMale array in CanShowOnCreate function
int autoGender = GetDefaultGenderForProfession(profession);
OnGenderSelected(autoGender);
UpdateConfirmButtonState();
}
/// <summary>
/// Gets the default gender for a profession based on the original C++ logic.
/// Matches the s_bShowMale array from EC_ProfConfigs.cpp CanShowOnCreate function.
/// </summary>
private int GetDefaultGenderForProfession(int profession)
{
if (profession >= 0 && profession < s_bShowMale.Length)
{
return s_bShowMale[profession] ? GENDER.GENDER_MALE : GENDER.GENDER_FEMALE;
}
// Fallback to male if profession is invalid
return GENDER.GENDER_MALE;
}
private void OnGenderSelected(int gender)
{
if (gender != GENDER.GENDER_MALE && gender != GENDER.GENDER_FEMALE)
return;
_currentGender = gender;
// Update UI to show selected gender
if (maleGenderButton != null)
{
var colors = maleGenderButton.colors;
colors.normalColor = (gender == GENDER.GENDER_MALE) ? Color.yellow : Color.white;
maleGenderButton.colors = colors;
}
if (femaleGenderButton != null)
{
var colors = femaleGenderButton.colors;
colors.normalColor = (gender == GENDER.GENDER_FEMALE) ? Color.yellow : Color.white;
femaleGenderButton.colors = colors;
}
UpdateConfirmButtonState();
}
private void OnConfirmClicked()
{
if (!CanConfirm())
return;
string characterName = nameInputField != null ? nameInputField.text : "";
if (string.IsNullOrWhiteSpace(characterName))
{
Debug.LogWarning("Character name cannot be empty");
return;
}
// Create RoleInfo using helper method
RoleInfo roleInfo = GameSession.CreateNewRoleInfo(characterName, _currentProfession, _currentGender);
// Create role via network
Debug.Log($"Calling CreateRoleAsync for character: {characterName}, profession: {_currentProfession}, gender: {_currentGender}");
UnityGameSession.CreateRoleAsync(roleInfo, new Octets(), (createdRole) =>
{
if (createdRole != null)
{
Debug.Log($"Character created successfully: {characterName}, RoleID: {createdRole.roleid}");
Hide();
_onCreateComplete?.Invoke(createdRole);
}
else
{
Debug.LogError($"Failed to create character: {characterName}. Check GameSession logs for error details.");
// TODO: Show error message to user
}
});
}
private void OnCancelClicked()
{
Hide();
_onCancel?.Invoke();
}
private bool CanConfirm()
{
if (_currentProfession < 0 || _currentProfession >= (int)Profession.NUM_PROFESSION)
return false;
if (_currentGender != GENDER.GENDER_MALE && _currentGender != GENDER.GENDER_FEMALE)
return false;
string name = nameInputField != null ? nameInputField.text : "";
if (string.IsNullOrWhiteSpace(name))
return false;
return true;
}
private void UpdateConfirmButtonState()
{
if (confirmButton != null)
{
confirmButton.interactable = CanConfirm();
}
}
private void Update()
{
// Update confirm button state in case name changes
if (nameInputField != null && nameInputField.isFocused)
{
UpdateConfirmButtonState();
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: aa9de023137e92348983cee3c59d620b
@@ -1,193 +1,282 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BrewMonster.Network;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace BrewMonster.UI
{
/// <summary>
/// Login Flow:
/// 1. Enter username and password
/// 2. Click login button
/// 3. Login success, get the list of characters
/// 4. Open the select character screen
/// </summary>
public class LoginScreenUI : MonoBehaviour
{
[SerializeField] private TMP_InputField _usernameInputField;
[SerializeField] private TMP_InputField _passwordInputField;
[SerializeField] private Button _loginButton;
[SerializeField] private SelecScreenCharacter _selectCharacterScreen;
private List<RoleInfo> _roleInfos;
bool isDoneWorldRender = false;
bool isDoneNPCRender = false;
private SynchronizationContext context;
public AudioClip loginBGM;
void Start()
{
AudioManager.Instance.PlayBGM(loginBGM, 1.5f);
_loginButton.onClick.AddListener(OnLoginButtonClicked);
context = SynchronizationContext.Current;
_usernameInputField.text = PlayerPrefs.GetString("username", "");
_passwordInputField.text = PlayerPrefs.GetString("password", "");
}
// Update is called once per frame
void Update()
{
if (_roleInfos != null)
{
_selectCharacterScreen.InitScreen(_roleInfos, OnClickSelectCharacter);
_roleInfos = null;
}
#if UNITY_EDITOR
if (Input.GetKeyUp(KeyCode.LeftAlt))
{
_usernameInputField.text = "test004";
_passwordInputField.text = "123456";
}
if (Input.GetKeyUp(KeyCode.Tab))
{
_usernameInputField.text = "test002";
_passwordInputField.text = "123456";
OnLoginButtonClicked();
}
#endif
}
public async void OnLoginButtonClicked()
{
BMLogger.Log("OnLoginButtonClicked");
string username = _usernameInputField.text;
string password = _passwordInputField.text;
// UnityGameSession.SetConnectionInfo("103.182.22.52", 29000);
UnityGameSession.SetConnectionInfo("103.51.120.195", 29000);
PlayerPrefs.SetString("username", username);
PlayerPrefs.SetString("password", password);
PlayerPrefs.Save();
await UnityGameSession.Login(username, password, OnLoginComplete);
_selectCharacterScreen.gameObject.SetActive(true);
}
/// <summary>
/// Callback when the login is complete.
/// Then get the list of characters
/// </summary>
private void OnLoginComplete(bool result)
{
if (!result)
{
BMLogger.LogError("Login failed");
return;
}
UnityGameSession.GetRoleListAsync(OnGetRoleListComplete);
}
/// <summary>
/// Callback when the list of characters is retrieved.
/// Then move to the select character screen
/// </summary>
private void OnGetRoleListComplete(List<RoleInfo> roleInfos)
{
_roleInfos = roleInfos;
}
private void OnClickSelectCharacter(RoleInfo roleInfo)
{
UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete);
}
private void OnSelectRoleComplete(RoleInfo roleInfo)
{
context.Post(_ =>
{
isDoneWorldRender = false;
isDoneNPCRender = false;
Action actLoadChar = () =>
{
if (!isDoneNPCRender || !isDoneWorldRender)
{
return;
}
};
SceneLoader.SceneLoadProcess = SceneLoadProcess.Loading;
SceneLoader.LoadingProgress = 0;
LoadingSceneController.Instance.ShowLoadingScene(true);
#if TESTFAST
string nameScene = "LoginScene";
SceneManager.UnloadSceneAsync(nameScene);
isDoneNPCRender = true;
isDoneWorldRender = true;
actLoadChar?.Invoke();
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
#else
string nameScene = "NPCRender";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) =>
{
isDoneNPCRender = value;
actLoadChar?.Invoke();
});
nameScene = "a61";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) =>
{
isDoneWorldRender = value;
actLoadChar?.Invoke();
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
});
#endif
}, null);
}
private async void OnEnterWorldComplete()
{
await Task.Delay(2000);
// Request all known packages: 0=Inventory,1=Equipment,2=Task
UnityGameSession.RequestAllInventoriesAsync(() => { /*BMLogger.Log("Sent Inventory Detail Requests (all packs)");*/ }, 0, 1, 2);
await Task.Delay(1000);
UnityGameSession.RequestCheckSecurityPassWd("");
await Task.Delay(1000);
}
//private void OnInventoryReceived(List<InventoryItem> inventoryData)
//{
// _inventoryUI.DisplayInventory(inventoryData);
//}
#if UNITY_EDITOR
private void OnValidate()
{
if (_usernameInputField == null)
{
// find childrend with name "username"
_usernameInputField = transform.Find("username").GetComponent<TMP_InputField>();
}
if (_passwordInputField == null)
{
// find childrend with name "password"
_passwordInputField = transform.Find("password").GetComponent<TMP_InputField>();
}
if (_loginButton == null)
{
// find childrend with name "LoginBtn"
_loginButton = transform.Find("LoginBtn").GetComponent<Button>();
}
}
#endif
}
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BrewMonster.Network;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace BrewMonster.UI
{
/// <summary>
/// Login Flow:
/// 1. Enter username and password
/// 2. Click login button
/// 3. Login success, get the list of characters
/// 4. Open the select character screen
/// </summary>
public class LoginScreenUI : MonoBehaviour
{
[SerializeField] private TMP_InputField _usernameInputField;
[SerializeField] private TMP_InputField _passwordInputField;
[SerializeField] private Button _loginButton;
[SerializeField] private SelecScreenCharacter _selectCharacterScreen;
private List<RoleInfo> _roleInfos;
private List<RoleInfo> _currentRoles;
private RoleInfo _pendingCreatedRole;
bool isDoneWorldRender = false;
bool isDoneNPCRender = false;
private SynchronizationContext context;
public AudioClip loginBGM;
void Start()
{
AudioManager.Instance.PlayBGM(loginBGM, 1.5f);
_loginButton.onClick.AddListener(OnLoginButtonClicked);
context = SynchronizationContext.Current;
_usernameInputField.text = PlayerPrefs.GetString("username", "");
_passwordInputField.text = PlayerPrefs.GetString("password", "");
}
// Update is called once per frame
void Update()
{
if (_roleInfos != null)
{
_selectCharacterScreen.InitScreen(_roleInfos, OnClickSelectCharacter, OnCreateCharacterComplete);
_roleInfos = null;
}
#if UNITY_EDITOR
if (Input.GetKeyUp(KeyCode.LeftAlt))
{
_usernameInputField.text = "test004";
_passwordInputField.text = "123456";
}
if (Input.GetKeyUp(KeyCode.Tab))
{
_usernameInputField.text = "test002";
_passwordInputField.text = "123456";
OnLoginButtonClicked();
}
#endif
}
public async void OnLoginButtonClicked()
{
BMLogger.Log("OnLoginButtonClicked");
string username = _usernameInputField.text;
string password = _passwordInputField.text;
// UnityGameSession.SetConnectionInfo("103.182.22.52", 29000);
UnityGameSession.SetConnectionInfo("103.51.120.195", 29000);
PlayerPrefs.SetString("username", username);
PlayerPrefs.SetString("password", password);
PlayerPrefs.Save();
await UnityGameSession.Login(username, password, OnLoginComplete);
_selectCharacterScreen.gameObject.SetActive(true);
}
/// <summary>
/// Callback when the login is complete.
/// Then get the list of characters
/// </summary>
private void OnLoginComplete(bool result)
{
if (!result)
{
BMLogger.LogError("Login failed");
return;
}
UnityGameSession.GetRoleListAsync(OnGetRoleListComplete);
}
/// <summary>
/// Callback when the list of characters is retrieved.
/// Then move to the select character screen
/// </summary>
private void OnGetRoleListComplete(List<RoleInfo> roleInfos)
{
if (roleInfos == null)
{
BMLogger.LogError("OnGetRoleListComplete: roleInfos is null");
// Keep whatever is currently shown; don't overwrite UI state with null.
return;
}
// Merge pending created role in case backend list hasn't updated yet.
if (_pendingCreatedRole != null)
{
bool exists = false;
for (int i = 0; i < roleInfos.Count; i++)
{
if (roleInfos[i].roleid == _pendingCreatedRole.roleid)
{
exists = true;
break;
}
}
if (!exists)
{
// Copy list so we don't mutate a list owned elsewhere.
var merged = new List<RoleInfo>(roleInfos.Count + 1);
merged.AddRange(roleInfos);
merged.Add(_pendingCreatedRole);
roleInfos = merged;
}
else
{
// Backend now includes the role; clear pending.
_pendingCreatedRole = null;
}
}
BMLogger.Log($"OnGetRoleListComplete: roles={roleInfos.Count}");
_roleInfos = roleInfos;
_currentRoles = roleInfos;
}
private void OnClickSelectCharacter(RoleInfo roleInfo)
{
UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete);
}
/// <summary>
/// Callback when a new character is created.
/// Refreshes the role list and keeps the character selection screen visible.
/// </summary>
private void OnCreateCharacterComplete(RoleInfo createdRole)
{
BMLogger.Log("Character created, refreshing role list...");
if (_selectCharacterScreen != null)
{
_selectCharacterScreen.gameObject.SetActive(true);
}
// Ensure the newly created role is visible immediately even if the server role list
// hasn't updated yet.
if (createdRole != null)
{
_pendingCreatedRole = createdRole;
if (_currentRoles == null)
{
_currentRoles = new List<RoleInfo>();
}
bool exists = false;
for (int i = 0; i < _currentRoles.Count; i++)
{
if (_currentRoles[i].roleid == createdRole.roleid)
{
exists = true;
break;
}
}
if (!exists)
{
_currentRoles.Add(createdRole);
}
_roleInfos = _currentRoles;
}
else
{
BMLogger.LogError("OnCreateCharacterComplete: createdRole is null (create-role callback returned null)");
}
// NOTE:
// Immediately requesting the role list after create has been observed to disconnect
// in some server builds. We rely on the createdRole callback to update UI instantly.
// A server sync can be done later (e.g., next time you open this screen / re-login).
}
private void OnSelectRoleComplete(RoleInfo roleInfo)
{
context.Post(_ =>
{
isDoneWorldRender = false;
isDoneNPCRender = false;
Action actLoadChar = () =>
{
if (!isDoneNPCRender || !isDoneWorldRender)
{
return;
}
};
SceneLoader.SceneLoadProcess = SceneLoadProcess.Loading;
SceneLoader.LoadingProgress = 0;
LoadingSceneController.Instance.ShowLoadingScene(true);
#if TESTFAST
string nameScene = "LoginScene";
SceneManager.UnloadSceneAsync(nameScene);
isDoneNPCRender = true;
isDoneWorldRender = true;
actLoadChar?.Invoke();
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
#else
string nameScene = "NPCRender";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) =>
{
isDoneNPCRender = value;
actLoadChar?.Invoke();
});
nameScene = "a61";
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) =>
{
isDoneWorldRender = value;
actLoadChar?.Invoke();
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
});
#endif
}, null);
}
private async void OnEnterWorldComplete()
{
await Task.Delay(2000);
// Request all known packages: 0=Inventory,1=Equipment,2=Task
UnityGameSession.RequestAllInventoriesAsync(() => { /*BMLogger.Log("Sent Inventory Detail Requests (all packs)");*/ }, 0, 1, 2);
await Task.Delay(1000);
UnityGameSession.RequestCheckSecurityPassWd("");
await Task.Delay(1000);
}
//private void OnInventoryReceived(List<InventoryItem> inventoryData)
//{
// _inventoryUI.DisplayInventory(inventoryData);
//}
#if UNITY_EDITOR
private void OnValidate()
{
if (_usernameInputField == null)
{
// find childrend with name "username"
_usernameInputField = transform.Find("username").GetComponent<TMP_InputField>();
}
if (_passwordInputField == null)
{
// find childrend with name "password"
_passwordInputField = transform.Find("password").GetComponent<TMP_InputField>();
}
if (_loginButton == null)
{
// find childrend with name "LoginBtn"
_loginButton = transform.Find("LoginBtn").GetComponent<Button>();
}
}
#endif
}
}
@@ -46,6 +46,19 @@ namespace BrewMonster.Scripts.UI
tmp.text = formattedText;
}
}
public void SetColor(Color color)
{
if (legacy != null)
{
legacy.color = color;
}
if (tmp != null)
{
tmp.color = color;
}
}
}
}

Before

Width:  |  Height:  |  Size: 634 KiB

After

Width:  |  Height:  |  Size: 634 KiB

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d2ab8e4bde76db4478aff9994361b46a
guid: 4276d7122cfaf624f8aa32336fc90f1c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
@@ -110,7 +110,7 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ChuTuyen_0
name: iconTask1_0
rect:
serializedVersion: 2
x: 201
@@ -125,8 +125,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 42af0f91f2269ff47b862dbb765d32f2
internalID: -338310257
spriteID: 3577b54168afc5242a9c02dce91f1260
internalID: 1049366989
vertices: []
indices:
edges: []
@@ -135,7 +135,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID: f1f78b52002efcf4da3264912e38dddb
spriteID: 16fc5ffd47ee2f1429eb79e647db644d
internalID: 0
vertices: []
indices:
@@ -145,7 +145,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
ChuTuyen_0: -338310257
iconTask1_0: 1049366989
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

Before

Width:  |  Height:  |  Size: 568 KiB

After

Width:  |  Height:  |  Size: 568 KiB

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 454cf3e89d0aaa54b9c60ca081ff5f46
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: iconTask2_0
rect:
serializedVersion: 2
x: 178
y: 221
width: 616
height: 628
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 88c7b386a6be7bd4dbb002f3a93895a1
internalID: -61588767
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: a16d633ba72e5c04487f3be78b1735bc
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
iconTask2_0: -61588767
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Before

Width:  |  Height:  |  Size: 640 KiB

After

Width:  |  Height:  |  Size: 640 KiB

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 13278f4394269834cb244620cd66c803
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: iconTask3_0
rect:
serializedVersion: 2
x: 154
y: 231
width: 632
height: 655
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 252520bbad7c9374e90d1c950b8482d6
internalID: 1481922406
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: fdab89333c5e8344e98af4bef992c422
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
iconTask3_0: 1481922406
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

@@ -1,12 +1,12 @@
fileFormatVersion: 2
guid: 7c5f76c428f533d4ca3a449e2bc02ff5
guid: f666d782d2b84fa48912bb3166f214aa
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@@ -37,13 +37,13 @@ TextureImporter:
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
@@ -52,9 +52,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
@@ -108,12 +108,34 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
sprites:
- serializedVersion: 2
name: iconTask4_0
rect:
serializedVersion: 2
x: 67
y: 108
width: 330
height: 312
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 591aabfa2f20afb4ea7673f8c6f3b77b
internalID: 799372409
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
spriteID: c8e66269510e1524eb24b5af756fb09f
internalID: 0
vertices: []
indices:
@@ -122,7 +144,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
iconTask4_0: 799372409
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: c27a0fab8aef4d74787fe56595601d9f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: iconTask5_0
rect:
serializedVersion: 2
x: 169
y: 91
width: 247
height: 246
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 81a887702ec996041a55a92f080c99e2
internalID: 1342343447
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: ee5d2861e27ff8f43bb7b8face30c7bb
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
iconTask5_0: 1342343447
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 6deb3d497e3c2a44cb875be0f13bbf36
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: iconTask6_0
rect:
serializedVersion: 2
x: 93
y: 79
width: 313
height: 343
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 18be220273ab7564389626093c9fa09a
internalID: 1458661374
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 33b9f9e65720df144a10109ca92117d7
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
iconTask6_0: 1458661374
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fd9306e92f60c254aba22e7fa622d485
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+4 -1
View File
@@ -578,7 +578,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
characterItemPrefab: {fileID: 5263746738484752443, guid: 726ee9eade6587245ac1b55d2335e9b9, type: 3}
addCharacterItemPrefab: {fileID: 5263746738484752443, guid: a0b31ed0940ec9942b243a0b8cec8ad3, type: 3}
parentItems: {fileID: 2643174602035272289}
createCharacterButton: {fileID: 0}
createCharacterScreen: {fileID: 0}
--- !u!1 &7510180475820570348
GameObject:
m_ObjectHideFlags: 0
@@ -717,7 +720,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &6444858493086001938
RectTransform:
m_ObjectHideFlags: 0
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a0b31ed0940ec9942b243a0b8cec8ad3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+11 -4
View File
@@ -147,7 +147,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3297168817873124018}
m_LocalRotation: {x: -0.08684798, y: 0.24095127, z: 0.02165367, w: 0.9664011}
m_LocalRotation: {x: -3.7702125e-16, y: 0.97228837, z: 0.23378475, w: 1.5679955e-15}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -255,7 +255,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &7509779512108699303
RectTransform:
m_ObjectHideFlags: 0
@@ -303,7 +303,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -338310257, guid: d2ab8e4bde76db4478aff9994361b46a, type: 3}
m_Sprite: {fileID: 1049366989, guid: 4276d7122cfaf624f8aa32336fc90f1c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -362,6 +362,13 @@ MonoBehaviour:
_healthText: {fileID: 0}
_healthImage: {fileID: 0}
_iconTaskMain: {fileID: 5100466107490290627}
_listIconTask:
- {fileID: 1049366989, guid: 4276d7122cfaf624f8aa32336fc90f1c, type: 3}
- {fileID: -61588767, guid: 454cf3e89d0aaa54b9c60ca081ff5f46, type: 3}
- {fileID: 1481922406, guid: 13278f4394269834cb244620cd66c803, type: 3}
- {fileID: 799372409, guid: f666d782d2b84fa48912bb3166f214aa, type: 3}
- {fileID: 1342343447, guid: c27a0fab8aef4d74787fe56595601d9f, type: 3}
- {fileID: 1458661374, guid: 6deb3d497e3c2a44cb875be0f13bbf36, type: 3}
--- !u!1 &6510845919681767284
GameObject:
m_ObjectHideFlags: 0
@@ -388,7 +395,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6510845919681767284}
m_LocalRotation: {x: 0.028356783, y: 0.9830809, z: 0.02226828, w: 0.17958853}
m_LocalRotation: {x: 0.15080568, y: -0.8027092, z: -0.16719593, w: 0.5522329}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
+1 -1
View File
@@ -6948,7 +6948,7 @@ namespace BrewMonster
for(i = 0; i < m_pEquipPack.GetSize(); i++)
{
var pItem = m_pEquipPack.GetItem(i);
if(pItem == null || (pItem is not EC_IvtrWeapon && pItem is not EC_IvtrArmor))
if(pItem == null)
{
continue;
}
+111 -5
View File
@@ -2,6 +2,7 @@ using CSNetwork.Protocols.RPCData;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BrewMonster;
namespace BrewMonster.UI
@@ -9,16 +10,121 @@ namespace BrewMonster.UI
public class SelecScreenCharacter : MonoBehaviour
{
[SerializeField] private GameObject characterItemPrefab;
[SerializeField] private GameObject addCharacterItemPrefab;
[SerializeField] private RectTransform parentItems;
[SerializeField] private Button createCharacterButton;
[SerializeField] private CreateCharacterScreen createCharacterScreen;
public void InitScreen(List<RoleInfo> roleInfos, Action<RoleInfo> OnClickItemChar)
private Action<RoleInfo> _onClickItemChar;
private Action<RoleInfo> _onCreateCharacterComplete;
private void Start()
{
foreach (RoleInfo info in roleInfos)
if (createCharacterButton != null)
{
CharacterItemUI item = Instantiate(characterItemPrefab, parentItems).GetComponent<CharacterItemUI>();
item.InitItem(info, OnClickItemChar);
createCharacterButton.onClick.AddListener(OnCreateCharacterClicked);
}
}
public void InitScreen(List<RoleInfo> roleInfos, Action<RoleInfo> OnClickItemChar, Action<RoleInfo> onCreateCharacterComplete = null)
{
_onClickItemChar = OnClickItemChar;
_onCreateCharacterComplete = onCreateCharacterComplete;
// Clear existing items
if (parentItems != null)
{
foreach (Transform child in parentItems)
{
Destroy(child.gameObject);
}
}
// Create character items
if (roleInfos != null)
{
foreach (RoleInfo info in roleInfos)
{
if (characterItemPrefab != null && parentItems != null)
{
CharacterItemUI item = Instantiate(characterItemPrefab, parentItems).GetComponent<CharacterItemUI>();
item.InitItem(info, OnClickItemChar);
}
}
// If number of roles < 8, spawn addCharacterItemPrefab and hide createCharacterButton
if (roleInfos.Count < 8)
{
// Hide the createCharacterButton
if (createCharacterButton != null)
{
createCharacterButton.gameObject.SetActive(false);
}
// Spawn addCharacterItemPrefab
if (addCharacterItemPrefab != null && parentItems != null)
{
GameObject addCharacterItem = Instantiate(addCharacterItemPrefab, parentItems);
// Set up click handler for the add character item
Button addButton = addCharacterItem.GetComponent<Button>();
if (addButton == null)
{
addButton = addCharacterItem.GetComponentInChildren<Button>();
}
if (addButton != null)
{
addButton.onClick.RemoveAllListeners();
addButton.onClick.AddListener(OnCreateCharacterClicked);
}
}
}
else
{
// Show the createCharacterButton if we have 8 or more roles
if (createCharacterButton != null)
{
createCharacterButton.gameObject.SetActive(true);
}
}
}
else
{
// If roleInfos is null, show createCharacterButton
if (createCharacterButton != null)
{
createCharacterButton.gameObject.SetActive(true);
}
}
}
private void OnCreateCharacterClicked()
{
if (createCharacterScreen != null)
{
gameObject.SetActive(false);
createCharacterScreen.Show(OnCreateCharacterComplete, OnCreateCharacterCancel);
}
}
private void OnCreateCharacterComplete(RoleInfo newRole)
{
if (createCharacterScreen != null)
{
createCharacterScreen.Hide();
}
gameObject.SetActive(true);
_onCreateCharacterComplete?.Invoke(newRole);
}
private void OnCreateCharacterCancel()
{
if (createCharacterScreen != null)
{
createCharacterScreen.Hide();
}
gameObject.SetActive(true);
}
}
}