예제 #1
0
        private void SyncLists(List <ActionParameter> externalParameters, List <ActionParameter> oldLocalParameters)
        {
            if (!hasUpgradedAgain)
            {
                // If parameters were deleted before upgrading, there may be a mismatch - so first ensure that order internal IDs match external

                if (oldLocalParameters != null && externalParameters != null && oldLocalParameters.Count != externalParameters.Count && oldLocalParameters.Count > 0)
                {
                    ACDebug.LogWarning("Parameter mismatch detected - please check the 'ActionList: Run' Action for its parameter values.");
                }

                for (int i = 0; i < externalParameters.Count; i++)
                {
                    if (i < oldLocalParameters.Count)
                    {
                        oldLocalParameters[i].ID = externalParameters[i].ID;
                    }
                }

                hasUpgradedAgain = true;
            }

            // Now that all parameter IDs match to begin with, we can rebuild the internal record based on the external parameters
            SetParametersBase.GUIData newGUIData = SetParametersBase.SyncLists(externalParameters, new SetParametersBase.GUIData(oldLocalParameters, parameterIDs));
            localParameters = newGUIData.fromParameters;
            parameterIDs    = newGUIData.parameterIDs;
        }
예제 #2
0
        private void SetParametersGUI(List <ActionParameter> externalParameters, List <ActionParameter> ownParameters = null)
        {
            runMode = (RunMode)EditorGUILayout.EnumPopup("Run mode:", runMode);
            if (runMode == RunMode.RunOnly)
            {
                return;
            }

            SetParametersBase.GUIData guiData = SetParametersBase.SetParametersGUI(externalParameters, isAssetFile, new SetParametersBase.GUIData(localParameters, parameterIDs), ownParameters);
            localParameters = guiData.fromParameters;
            parameterIDs    = guiData.parameterIDs;
        }
예제 #3
0
        private void SetParametersGUI(List <ActionParameter> externalParameters, List <ActionParameter> ownParameters = null)
        {
            setParameters = EditorGUILayout.Toggle("Set parameters?", setParameters);
            if (!setParameters)
            {
                return;
            }

            SetParametersBase.GUIData guiData = SetParametersBase.SetParametersGUI(externalParameters, isAssetFile, new SetParametersBase.GUIData(localParameters, parameterIDs), ownParameters);
            localParameters = guiData.fromParameters;
            parameterIDs    = guiData.parameterIDs;
        }
 private List <ActionListAsset> GetAssetsFromParameterGUIData(SetParametersBase.GUIData guiData, List <ActionListAsset> existingList)
 {
     if (guiData.fromParameters != null)
     {
         foreach (ActionParameter parameter in guiData.fromParameters)
         {
             if (parameter.parameterType == ParameterType.UnityObject)
             {
                 if (parameter.objectValue != null)
                 {
                     if (parameter.objectValue is ActionListAsset)
                     {
                         ActionListAsset _actionListAsset = (ActionListAsset)parameter.objectValue;
                         existingList.Add(_actionListAsset);
                     }
                 }
             }
         }
     }
     return(existingList);
 }