@@ -4,6 +4,8 @@ import { actionName, state, uiData } from "meta3d-action-mod-unit-select-prop-pr
44import { eventName , inputData } from "meta3d-action-mod-unit-select-prop-protocol/src/EventType"
55import { actionName as initActionName , state as initState } from "meta3d-action-mod-unit-init-protocol"
66import { count , rate } from "meta3d-action-mod-unit-publish-to-game-protocol/src/Type"
7+ import { getLanguageTextVariableData } from "meta3d-language-utils/src/Main"
8+ import { languageVariableKey } from "meta3d-language-utils/src/Type"
79
810export let getContribute : getContributeMeta3D < actionContribute < uiData , state > > = ( api ) => {
911 return {
@@ -15,7 +17,15 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
1517 resolve ( eventSourcingService . on < inputData > ( meta3dState , eventName , 0 , ( meta3dState , index ) => {
1618 let state = api . nullable . getExn ( api . action . getActionState < initState > ( meta3dState , initActionName ) )
1719
18- let prop = api . nullable . getExn ( state . allPropData . get ( index ) )
20+ if ( state . prop . length >= 5 ) {
21+ api . message . warn ( getLanguageTextVariableData ( api , meta3dState , languageVariableKey . LimitMaxCount ) ( 5 ) )
22+
23+ return Promise . resolve ( meta3dState )
24+ }
25+
26+ let prop = api . nullable . getExn ( state . allPropData . filter ( d => {
27+ return state . prop . filter ( p => p . name == d . name ) . length == 0
28+ } ) . get ( index ) )
1929
2030 meta3dState = api . action . setActionState < initState > ( meta3dState , initActionName , {
2131 ...state ,
0 commit comments