DayZ 1.24
Loading...
Searching...
No Matches
PPERequestPlatformsBase.c File Reference

Go to the source code of this file.

Classes

class  PPERequesterBase
 

Functions

class PPERequesterBase GetCategoryMask ()
 mask for mass-handling methods like 'StopAllEffects'
 
void PPERequesterBase (int requester_IDX)
 
void SetRequesterUpdating (bool state)
 Has to be set for the requester to be handled.
 
void Start (Param par=null)
 
void Stop (Param par=null)
 
bool IsRequesterRunning ()
 
void SetRequesterIDX (int idx)
 automatically assigned by PPERequesterBank
 
int GetRequesterIDX ()
 Returns requester index.
 
void SetTargetValueBool (int mat_id, int param_idx, bool val, int priority_layer, int operator=PPOperators.SET)
 
void SetTargetValueBoolDefault (int mat_id, int param_idx)
 
void SetTargetValueInt (int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator=PPOperators.SET)
 
void SetTargetValueIntDefault (int mat_id, int param_idx)
 
void SetTargetValueFloat (int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
 
void SetTargetValueFloatDefault (int mat_id, int param_idx)
 
void SetTargetValueColor (int mat_id, int param_idx, ref array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
 
void SetTargetValueColorDefault (int mat_id, int param_idx)
 
void QueueValuesSend ()
 Sets this requester to update in the manager.
 
PPERequestParamDataBase GetRequestData (int mat_id, int param_idx, int type)
 returns request data for specific parameter, or creates one if one does not exist in this request yet (singletons)
 
PPERequestParamDataBase PrepareData (int mat_id, int param_idx, int type)
 
map< int, ref map< int, ref PPERequestParamDataBase > > GetActiveRequestStructure ()
 
void ClearRequesterData ()
 
void SendCurrentValueData (PPERequestParamDataBase data)
 
void OnUpdate (float delta)
 
void OnStart (Param par=null)
 
void OnStop (Param par=null)
 automatically resets all material parameters of this requester to defaults
 
float RelativizeValue (float value, int var_type, int mat_id, int param_id, bool relative)
 converts all values used to relative values (if not relative already)
 
void SetDefaultValuesAll ()
 Sets all requested values to default, ignoring them in further calculations.
 
void DbgPrnt (string text)
 

Variables

bool m_IsRunning
 
bool m_ValuesSent
 
int m_IDX
 
bool m_Valid = false
 
ref map< int, ref map< int, ref PPERequestParamDataBase > > m_RequestDataStructure
 

Function Documentation

◆ ClearRequesterData()

void GetCategoryMask::ClearRequesterData ( )
protected

Definition at line 749 of file PPERequestPlatformsBase.c.

◆ DbgPrnt()

void GetCategoryMask::DbgPrnt ( string text)
protected

Definition at line 849 of file PPERequestPlatformsBase.c.

851{
852 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
853 protected bool m_ValuesSent;
854 protected int m_IDX;
855
856 protected bool m_Valid = false;
857
858 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
859
861 {
862 m_Valid = PPERequesterBank.VerifyRequester(this);
863
865 m_ValuesSent = true;
866 m_IsRunning = false;
868 }
869
871 void SetRequesterUpdating(bool state)
872 {
873 if (!m_Valid)
874 {
875 Debug.Log("" + this + " not valid!");
876 return;
877 }
878
879 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
880
881 //TODO - separate into its own function?
882 if (state)
883 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
884 }
885
886 void Start(Param par = null)
887 {
888 OnStart(par);
889 m_IsRunning = true;
890 }
891
892 void Stop(Param par = null)
893 {
895 return;
896
897 OnStop(par);
898 m_IsRunning = false;
899 }
900
901 bool IsRequesterRunning()
902 {
903 return m_IsRunning;
904 }
905
907 void SetRequesterIDX(int idx)
908 {
909 m_IDX = idx;
910 }
911
913 int GetRequesterIDX()
914 {
915 return m_IDX;
916 }
917
919 int GetCategoryMask()
920 {
921 return PPERequesterCategory.NONE;
922 }
923
924 //SETTERS//
925 //vvvvvvv//
926 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
927 {
929 return;
930
932 data.SetPriorityLayer(priority_layer);
933 data.SetInteractionMask(operator);
934
935 data.m_BoolTarget = val;
936 data.m_BoolLast = data.m_BoolCurrent;
937
938 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
939 {
940 data.SetSettingDefaultValues(false);
941 data.SetDataActive(true);
942
944 }
945 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
946 }
947
948 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
949 {
950 //TODO - running check and cleanup rework (elsewhere!)
952 return;
953
955 data.m_BoolLast = data.m_BoolCurrent;
956 if (!data.IsSettingDefaultValues())
957 {
958 data.SetSettingDefaultValues(true);
959
961 }
962 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
963 }
964
965 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
966 {
968 return;
969
970 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
971 data.SetPriorityLayer(priority_layer);
972 data.SetInteractionMask(operator);
973
974 data.m_IntTarget = val;
975 data.m_IntLast = data.m_IntCurrent;
976 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
977 {
978 data.SetSettingDefaultValues(false);
979 data.SetDataActive(true);
980
982 }
983 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
984 }
985
986 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
987 {
988 //TODO - running check and cleanup rework (elsewhere!)
990 return;
991
992 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
993 data.m_IntLast = data.m_IntCurrent;
994 if (!data.IsSettingDefaultValues())
995 {
996 data.SetSettingDefaultValues(true);
997
999 }
1000 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1001 }
1002
1003 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1004 {
1006 return;
1007
1009 data.SetPriorityLayer(priority_layer);
1010 data.SetInteractionMask(operator);
1011
1012 data.m_FloatFormerTarget = data.m_FloatTarget;
1013 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
1014 data.m_FloatLast = data.m_FloatCurrent;
1015 data.m_FloatStart = data.m_FloatCurrent;
1016 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
1017 {
1018 data.SetSettingDefaultValues(false);
1019 data.SetDataActive(true);
1020
1022 }
1023 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1024 }
1025
1026 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
1027 {
1028 //TODO - running check and cleanup rework (elsewhere!)
1030 return;
1031
1033 data.m_FloatFormerTarget = data.m_FloatTarget;
1034 data.m_FloatLast = data.m_FloatCurrent;
1035 data.m_FloatStart = data.m_FloatCurrent;
1036 if (!data.IsSettingDefaultValues())
1037 {
1038 data.SetSettingDefaultValues(true);
1039
1041 }
1042 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1043 }
1044
1045 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1046 {
1048 return;
1049
1050 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1051 data.SetPriorityLayer(priority_layer);
1052 data.SetInteractionMask(operator);
1053 data.m_ColorFormerTarget = data.m_ColorTarget;
1054
1055 data.m_ColorTarget.Copy(val);
1056
1057 data.m_ColorLast = data.m_ColorCurrent;
1058 data.m_ColorStart = data.m_ColorCurrent;
1059 //if (data.m_ColorTarget != data.m_ColorCurrent)
1060 {
1061 data.SetSettingDefaultValues(false);
1062 data.SetDataActive(true);
1063
1065 }
1066 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1067 }
1068
1069 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
1070 {
1071 //TODO - running check and cleanup rework (elsewhere!)
1073 return;
1074
1075 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1076 data.m_ColorFormerTarget = data.m_ColorTarget;
1077 data.m_ColorLast = data.m_ColorCurrent;
1078 data.m_ColorStart = data.m_ColorCurrent;
1079 if (!data.IsSettingDefaultValues())
1080 {
1081 data.SetSettingDefaultValues(true);
1082
1084 }
1085 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1086 }
1087
1088 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1089 {
1090 }
1091
1092 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1093 {
1094 }*/
1095
1096 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1097 {
1098 }*/
1099
1101 protected void QueueValuesSend()
1102 {
1103 m_ValuesSent = false;
1104 //m_IsRunning = true;
1106 }
1107
1110 {
1113 {
1116 else
1117 {
1118 data = PrepareData(mat_id, param_idx, type);
1120 }
1121 }
1122 else
1123 {
1124 data = PrepareData(mat_id, param_idx, type);
1126 temp_map.Set(param_idx, data);
1128 }
1129
1130 if (!data)
1131 Error("GetRequestData | no data found in the structure");
1132
1133 data.m_Requester = this;
1134
1135 return data;
1136 }
1137
1138 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1139 {
1141 switch (type)
1142 {
1143 case PPEConstants.VAR_TYPE_BOOL:
1145 break;
1146
1147 case PPEConstants.VAR_TYPE_INT:
1148 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1149 break;
1150
1151 case PPEConstants.VAR_TYPE_FLOAT:
1153 break;
1154
1155 case PPEConstants.VAR_TYPE_COLOR:
1156 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1157 break;
1158 }
1159 return data;
1160 }
1161
1162 // unused?
1164 {
1166 }
1167
1168 protected void ClearRequesterData()
1169 {
1170 m_RequestDataStructure.Clear();
1171 }
1172
1174 {
1175 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1176 }
1177
1178 //EVENTS//
1179 //vvvvvv//
1180 void OnUpdate(float delta)
1181 {
1182 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1183
1184 if (!m_ValuesSent)
1185 {
1186 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1187 {
1188 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1189 {
1190 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1191 }
1192 }
1193 m_ValuesSent = true;
1194 }
1195 SetRequesterUpdating(false);
1196 }
1197
1198 protected void OnStart(Param par = null)
1199 {
1201 }
1202
1204 protected void OnStop(Param par = null)
1205 {
1206 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1209 }
1210
1212 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1213 {
1214 float ret = value;
1215 if (!relative) //if not already relative...
1216 {
1217 switch (var_type)
1218 {
1219 case PPEConstants.VAR_TYPE_FLOAT:
1221 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1222 ret = Math.Clamp(ret, 0.0, 1.0);
1223 break;
1224 }
1225 }
1226 //Print("RelativizeValue: " + ret);
1227
1228 return ret;
1229 }
1230
1232 protected void SetDefaultValuesAll()
1233 {
1234 //<material<param_id,data>>
1236
1237 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1238 {
1239 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1240 {
1241 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1242
1243 if (!req_data.IsDataActive())
1244 continue;
1245
1246 switch (req_data.GetVarType())
1247 {
1248 case PPEConstants.VAR_TYPE_BOOL:
1249 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1250 break;
1251
1252 case PPEConstants.VAR_TYPE_INT:
1253 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1254 break;
1255
1256 case PPEConstants.VAR_TYPE_FLOAT:
1257 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1258 break;
1259
1260 case PPEConstants.VAR_TYPE_COLOR:
1261 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1262 break;
1263 }
1264 }
1265 }
1266 }
1267
1268 void DbgPrnt(string text)
1269 {
1270 //Debug.Log(""+text);
1271 }
1272}
1273
1275// Base requester platforms //
1277
1279{
1280 override int GetCategoryMask()
1281 {
1282 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1283 }
1284}
1285
1287{
1288 override int GetCategoryMask()
1289 {
1290 return PPERequesterCategory.MENU_EFFECTS;
1291 }
1292}
void Start()
Plays all elements this effects consists of.
Definition Effect.c:149
void Stop()
Stops all elements this effect consists of.
Definition Effect.c:175
PPOperators
PP operators, specify operation between subsequent layers.
PPERequesterCategory
void PPERequestParamDataBool(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
void PPERequestParamDataFloat(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
void OnStop(Param par=null)
automatically resets all material parameters of this requester to defaults
bool m_IsRunning
void SetTargetValueBoolDefault(int mat_id, int param_idx)
void SendCurrentValueData(PPERequestParamDataBase data)
void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator=PPOperators.SET)
void OnStart(Param par=null)
void SetTargetValueFloatDefault(int mat_id, int param_idx)
int GetRequesterIDX()
Returns requester index.
map< int, ref map< int, ref PPERequestParamDataBase > > GetActiveRequestStructure()
bool IsRequesterRunning()
void SetTargetValueColorDefault(int mat_id, int param_idx)
void SetRequesterIDX(int idx)
automatically assigned by PPERequesterBank
ref map< int, ref map< int, ref PPERequestParamDataBase > > m_RequestDataStructure
float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
converts all values used to relative values (if not relative already)
void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void DbgPrnt(string text)
void SetDefaultValuesAll()
Sets all requested values to default, ignoring them in further calculations.
void QueueValuesSend()
Sets this requester to update in the manager.
void SetRequesterUpdating(bool state)
Has to be set for the requester to be handled.
void PPERequesterBase(int requester_IDX)
class PPERequesterBase GetCategoryMask()
mask for mass-handling methods like 'StopAllEffects'
void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator=PPOperators.SET)
void SetTargetValueIntDefault(int mat_id, int param_idx)
PPERequestParamDataBase GetRequestData(int mat_id, int param_idx, int type)
returns request data for specific parameter, or creates one if one does not exist in this request yet...
PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
bool m_ValuesSent
void SetTargetValueColor(int mat_id, int param_idx, ref array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void ClearRequesterData()
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Definition EnMath.c:7
Static component of PPE manager, used to hold the instance.
Definition PPEManager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition PPEManager.c:27
Data for one material parameter, requester side.
base, not to be used directly, would lead to layering collisions!
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
proto native void OnUpdate()
Definition tools.c:333

◆ GetActiveRequestStructure()

map< int, ref map< int, ref PPERequestParamDataBase > > GetCategoryMask::GetActiveRequestStructure ( )
protected

Definition at line 744 of file PPERequestPlatformsBase.c.

746{
747 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
748 protected bool m_ValuesSent;
749 protected int m_IDX;
750
751 protected bool m_Valid = false;
752
753 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
754
756 {
757 m_Valid = PPERequesterBank.VerifyRequester(this);
758
760 m_ValuesSent = true;
761 m_IsRunning = false;
763 }
764
766 void SetRequesterUpdating(bool state)
767 {
768 if (!m_Valid)
769 {
770 Debug.Log("" + this + " not valid!");
771 return;
772 }
773
774 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
775
776 //TODO - separate into its own function?
777 if (state)
778 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
779 }
780
781 void Start(Param par = null)
782 {
783 OnStart(par);
784 m_IsRunning = true;
785 }
786
787 void Stop(Param par = null)
788 {
790 return;
791
792 OnStop(par);
793 m_IsRunning = false;
794 }
795
796 bool IsRequesterRunning()
797 {
798 return m_IsRunning;
799 }
800
802 void SetRequesterIDX(int idx)
803 {
804 m_IDX = idx;
805 }
806
808 int GetRequesterIDX()
809 {
810 return m_IDX;
811 }
812
814 int GetCategoryMask()
815 {
816 return PPERequesterCategory.NONE;
817 }
818
819 //SETTERS//
820 //vvvvvvv//
821 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
822 {
824 return;
825
827 data.SetPriorityLayer(priority_layer);
828 data.SetInteractionMask(operator);
829
830 data.m_BoolTarget = val;
831 data.m_BoolLast = data.m_BoolCurrent;
832
833 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
834 {
835 data.SetSettingDefaultValues(false);
836 data.SetDataActive(true);
837
839 }
840 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
841 }
842
843 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
844 {
845 //TODO - running check and cleanup rework (elsewhere!)
847 return;
848
850 data.m_BoolLast = data.m_BoolCurrent;
851 if (!data.IsSettingDefaultValues())
852 {
853 data.SetSettingDefaultValues(true);
854
856 }
857 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
858 }
859
860 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
861 {
863 return;
864
865 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
866 data.SetPriorityLayer(priority_layer);
867 data.SetInteractionMask(operator);
868
869 data.m_IntTarget = val;
870 data.m_IntLast = data.m_IntCurrent;
871 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
872 {
873 data.SetSettingDefaultValues(false);
874 data.SetDataActive(true);
875
877 }
878 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
879 }
880
881 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
882 {
883 //TODO - running check and cleanup rework (elsewhere!)
885 return;
886
887 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
888 data.m_IntLast = data.m_IntCurrent;
889 if (!data.IsSettingDefaultValues())
890 {
891 data.SetSettingDefaultValues(true);
892
894 }
895 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
896 }
897
898 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
899 {
901 return;
902
904 data.SetPriorityLayer(priority_layer);
905 data.SetInteractionMask(operator);
906
907 data.m_FloatFormerTarget = data.m_FloatTarget;
908 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
909 data.m_FloatLast = data.m_FloatCurrent;
910 data.m_FloatStart = data.m_FloatCurrent;
911 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
912 {
913 data.SetSettingDefaultValues(false);
914 data.SetDataActive(true);
915
917 }
918 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
919 }
920
921 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
922 {
923 //TODO - running check and cleanup rework (elsewhere!)
925 return;
926
928 data.m_FloatFormerTarget = data.m_FloatTarget;
929 data.m_FloatLast = data.m_FloatCurrent;
930 data.m_FloatStart = data.m_FloatCurrent;
931 if (!data.IsSettingDefaultValues())
932 {
933 data.SetSettingDefaultValues(true);
934
936 }
937 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
938 }
939
940 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
941 {
943 return;
944
945 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
946 data.SetPriorityLayer(priority_layer);
947 data.SetInteractionMask(operator);
948 data.m_ColorFormerTarget = data.m_ColorTarget;
949
950 data.m_ColorTarget.Copy(val);
951
952 data.m_ColorLast = data.m_ColorCurrent;
953 data.m_ColorStart = data.m_ColorCurrent;
954 //if (data.m_ColorTarget != data.m_ColorCurrent)
955 {
956 data.SetSettingDefaultValues(false);
957 data.SetDataActive(true);
958
960 }
961 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
962 }
963
964 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
965 {
966 //TODO - running check and cleanup rework (elsewhere!)
968 return;
969
970 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
971 data.m_ColorFormerTarget = data.m_ColorTarget;
972 data.m_ColorLast = data.m_ColorCurrent;
973 data.m_ColorStart = data.m_ColorCurrent;
974 if (!data.IsSettingDefaultValues())
975 {
976 data.SetSettingDefaultValues(true);
977
979 }
980 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
981 }
982
983 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
984 {
985 }
986
987 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
988 {
989 }*/
990
991 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
992 {
993 }*/
994
996 protected void QueueValuesSend()
997 {
998 m_ValuesSent = false;
999 //m_IsRunning = true;
1001 }
1002
1005 {
1008 {
1011 else
1012 {
1013 data = PrepareData(mat_id, param_idx, type);
1015 }
1016 }
1017 else
1018 {
1019 data = PrepareData(mat_id, param_idx, type);
1021 temp_map.Set(param_idx, data);
1023 }
1024
1025 if (!data)
1026 Error("GetRequestData | no data found in the structure");
1027
1028 data.m_Requester = this;
1029
1030 return data;
1031 }
1032
1033 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1034 {
1036 switch (type)
1037 {
1038 case PPEConstants.VAR_TYPE_BOOL:
1040 break;
1041
1042 case PPEConstants.VAR_TYPE_INT:
1043 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1044 break;
1045
1046 case PPEConstants.VAR_TYPE_FLOAT:
1048 break;
1049
1050 case PPEConstants.VAR_TYPE_COLOR:
1051 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1052 break;
1053 }
1054 return data;
1055 }
1056
1057 // unused?
1059 {
1061 }
1062
1063 protected void ClearRequesterData()
1064 {
1065 m_RequestDataStructure.Clear();
1066 }
1067
1069 {
1070 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1071 }
1072
1073 //EVENTS//
1074 //vvvvvv//
1075 void OnUpdate(float delta)
1076 {
1077 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1078
1079 if (!m_ValuesSent)
1080 {
1081 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1082 {
1083 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1084 {
1085 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1086 }
1087 }
1088 m_ValuesSent = true;
1089 }
1090 SetRequesterUpdating(false);
1091 }
1092
1093 protected void OnStart(Param par = null)
1094 {
1096 }
1097
1099 protected void OnStop(Param par = null)
1100 {
1101 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1104 }
1105
1107 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1108 {
1109 float ret = value;
1110 if (!relative) //if not already relative...
1111 {
1112 switch (var_type)
1113 {
1114 case PPEConstants.VAR_TYPE_FLOAT:
1116 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1117 ret = Math.Clamp(ret, 0.0, 1.0);
1118 break;
1119 }
1120 }
1121 //Print("RelativizeValue: " + ret);
1122
1123 return ret;
1124 }
1125
1127 protected void SetDefaultValuesAll()
1128 {
1129 //<material<param_id,data>>
1131
1132 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1133 {
1134 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1135 {
1136 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1137
1138 if (!req_data.IsDataActive())
1139 continue;
1140
1141 switch (req_data.GetVarType())
1142 {
1143 case PPEConstants.VAR_TYPE_BOOL:
1144 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1145 break;
1146
1147 case PPEConstants.VAR_TYPE_INT:
1148 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1149 break;
1150
1151 case PPEConstants.VAR_TYPE_FLOAT:
1152 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1153 break;
1154
1155 case PPEConstants.VAR_TYPE_COLOR:
1156 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1157 break;
1158 }
1159 }
1160 }
1161 }
1162
1163 void DbgPrnt(string text)
1164 {
1165 //Debug.Log(""+text);
1166 }
1167}
1168
1170// Base requester platforms //
1172
1174{
1175 override int GetCategoryMask()
1176 {
1177 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1178 }
1179}
1180
1182{
1183 override int GetCategoryMask()
1184 {
1185 return PPERequesterCategory.MENU_EFFECTS;
1186 }
1187}

◆ GetCategoryMask()

int GetCategoryMask ( )

mask for mass-handling methods like 'StopAllEffects'

Definition at line 1 of file PPERequestPlatformsBase.c.

433 {
434 return PPERequesterCategory.GAMEPLAY_EFFECTS;
435 }

◆ GetRequestData()

PPERequestParamDataBase GetCategoryMask::GetRequestData ( int mat_id,
int param_idx,
int type )
protected

returns request data for specific parameter, or creates one if one does not exist in this request yet (singletons)

Definition at line 690 of file PPERequestPlatformsBase.c.

692{
693 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
694 protected bool m_ValuesSent;
695 protected int m_IDX;
696
697 protected bool m_Valid = false;
698
699 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
700
702 {
703 m_Valid = PPERequesterBank.VerifyRequester(this);
704
706 m_ValuesSent = true;
707 m_IsRunning = false;
709 }
710
712 void SetRequesterUpdating(bool state)
713 {
714 if (!m_Valid)
715 {
716 Debug.Log("" + this + " not valid!");
717 return;
718 }
719
720 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
721
722 //TODO - separate into its own function?
723 if (state)
724 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
725 }
726
727 void Start(Param par = null)
728 {
729 OnStart(par);
730 m_IsRunning = true;
731 }
732
733 void Stop(Param par = null)
734 {
736 return;
737
738 OnStop(par);
739 m_IsRunning = false;
740 }
741
742 bool IsRequesterRunning()
743 {
744 return m_IsRunning;
745 }
746
748 void SetRequesterIDX(int idx)
749 {
750 m_IDX = idx;
751 }
752
754 int GetRequesterIDX()
755 {
756 return m_IDX;
757 }
758
760 int GetCategoryMask()
761 {
762 return PPERequesterCategory.NONE;
763 }
764
765 //SETTERS//
766 //vvvvvvv//
767 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
768 {
770 return;
771
773 data.SetPriorityLayer(priority_layer);
774 data.SetInteractionMask(operator);
775
776 data.m_BoolTarget = val;
777 data.m_BoolLast = data.m_BoolCurrent;
778
779 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
780 {
781 data.SetSettingDefaultValues(false);
782 data.SetDataActive(true);
783
785 }
786 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
787 }
788
789 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
790 {
791 //TODO - running check and cleanup rework (elsewhere!)
793 return;
794
796 data.m_BoolLast = data.m_BoolCurrent;
797 if (!data.IsSettingDefaultValues())
798 {
799 data.SetSettingDefaultValues(true);
800
802 }
803 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
804 }
805
806 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
807 {
809 return;
810
811 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
812 data.SetPriorityLayer(priority_layer);
813 data.SetInteractionMask(operator);
814
815 data.m_IntTarget = val;
816 data.m_IntLast = data.m_IntCurrent;
817 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
818 {
819 data.SetSettingDefaultValues(false);
820 data.SetDataActive(true);
821
823 }
824 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
825 }
826
827 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
828 {
829 //TODO - running check and cleanup rework (elsewhere!)
831 return;
832
833 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
834 data.m_IntLast = data.m_IntCurrent;
835 if (!data.IsSettingDefaultValues())
836 {
837 data.SetSettingDefaultValues(true);
838
840 }
841 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
842 }
843
844 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
845 {
847 return;
848
850 data.SetPriorityLayer(priority_layer);
851 data.SetInteractionMask(operator);
852
853 data.m_FloatFormerTarget = data.m_FloatTarget;
854 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
855 data.m_FloatLast = data.m_FloatCurrent;
856 data.m_FloatStart = data.m_FloatCurrent;
857 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
858 {
859 data.SetSettingDefaultValues(false);
860 data.SetDataActive(true);
861
863 }
864 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
865 }
866
867 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
868 {
869 //TODO - running check and cleanup rework (elsewhere!)
871 return;
872
874 data.m_FloatFormerTarget = data.m_FloatTarget;
875 data.m_FloatLast = data.m_FloatCurrent;
876 data.m_FloatStart = data.m_FloatCurrent;
877 if (!data.IsSettingDefaultValues())
878 {
879 data.SetSettingDefaultValues(true);
880
882 }
883 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
884 }
885
886 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
887 {
889 return;
890
891 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
892 data.SetPriorityLayer(priority_layer);
893 data.SetInteractionMask(operator);
894 data.m_ColorFormerTarget = data.m_ColorTarget;
895
896 data.m_ColorTarget.Copy(val);
897
898 data.m_ColorLast = data.m_ColorCurrent;
899 data.m_ColorStart = data.m_ColorCurrent;
900 //if (data.m_ColorTarget != data.m_ColorCurrent)
901 {
902 data.SetSettingDefaultValues(false);
903 data.SetDataActive(true);
904
906 }
907 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
908 }
909
910 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
911 {
912 //TODO - running check and cleanup rework (elsewhere!)
914 return;
915
916 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
917 data.m_ColorFormerTarget = data.m_ColorTarget;
918 data.m_ColorLast = data.m_ColorCurrent;
919 data.m_ColorStart = data.m_ColorCurrent;
920 if (!data.IsSettingDefaultValues())
921 {
922 data.SetSettingDefaultValues(true);
923
925 }
926 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
927 }
928
929 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
930 {
931 }
932
933 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
934 {
935 }*/
936
937 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
938 {
939 }*/
940
942 protected void QueueValuesSend()
943 {
944 m_ValuesSent = false;
945 //m_IsRunning = true;
947 }
948
951 {
954 {
957 else
958 {
961 }
962 }
963 else
964 {
967 temp_map.Set(param_idx, data);
969 }
970
971 if (!data)
972 Error("GetRequestData | no data found in the structure");
973
974 data.m_Requester = this;
975
976 return data;
977 }
978
979 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
980 {
982 switch (type)
983 {
984 case PPEConstants.VAR_TYPE_BOOL:
986 break;
987
988 case PPEConstants.VAR_TYPE_INT:
989 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
990 break;
991
992 case PPEConstants.VAR_TYPE_FLOAT:
994 break;
995
996 case PPEConstants.VAR_TYPE_COLOR:
997 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
998 break;
999 }
1000 return data;
1001 }
1002
1003 // unused?
1005 {
1007 }
1008
1009 protected void ClearRequesterData()
1010 {
1011 m_RequestDataStructure.Clear();
1012 }
1013
1015 {
1016 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1017 }
1018
1019 //EVENTS//
1020 //vvvvvv//
1021 void OnUpdate(float delta)
1022 {
1023 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1024
1025 if (!m_ValuesSent)
1026 {
1027 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1028 {
1029 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1030 {
1031 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1032 }
1033 }
1034 m_ValuesSent = true;
1035 }
1036 SetRequesterUpdating(false);
1037 }
1038
1039 protected void OnStart(Param par = null)
1040 {
1042 }
1043
1045 protected void OnStop(Param par = null)
1046 {
1047 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1050 }
1051
1053 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1054 {
1055 float ret = value;
1056 if (!relative) //if not already relative...
1057 {
1058 switch (var_type)
1059 {
1060 case PPEConstants.VAR_TYPE_FLOAT:
1062 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1063 ret = Math.Clamp(ret, 0.0, 1.0);
1064 break;
1065 }
1066 }
1067 //Print("RelativizeValue: " + ret);
1068
1069 return ret;
1070 }
1071
1073 protected void SetDefaultValuesAll()
1074 {
1075 //<material<param_id,data>>
1077
1078 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1079 {
1080 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1081 {
1082 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1083
1084 if (!req_data.IsDataActive())
1085 continue;
1086
1087 switch (req_data.GetVarType())
1088 {
1089 case PPEConstants.VAR_TYPE_BOOL:
1090 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1091 break;
1092
1093 case PPEConstants.VAR_TYPE_INT:
1094 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1095 break;
1096
1097 case PPEConstants.VAR_TYPE_FLOAT:
1098 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1099 break;
1100
1101 case PPEConstants.VAR_TYPE_COLOR:
1102 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1103 break;
1104 }
1105 }
1106 }
1107 }
1108
1109 void DbgPrnt(string text)
1110 {
1111 //Debug.Log(""+text);
1112 }
1113}
1114
1116// Base requester platforms //
1118
1120{
1121 override int GetCategoryMask()
1122 {
1123 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1124 }
1125}
1126
1128{
1129 override int GetCategoryMask()
1130 {
1131 return PPERequesterCategory.MENU_EFFECTS;
1132 }
1133}

◆ GetRequesterIDX()

int GetCategoryMask::GetRequesterIDX ( )
protected

Returns requester index.

Definition at line 494 of file PPERequestPlatformsBase.c.

496{
497 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
498 protected bool m_ValuesSent;
499 protected int m_IDX;
500
501 protected bool m_Valid = false;
502
503 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
504
506 {
507 m_Valid = PPERequesterBank.VerifyRequester(this);
508
510 m_ValuesSent = true;
511 m_IsRunning = false;
513 }
514
516 void SetRequesterUpdating(bool state)
517 {
518 if (!m_Valid)
519 {
520 Debug.Log("" + this + " not valid!");
521 return;
522 }
523
524 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
525
526 //TODO - separate into its own function?
527 if (state)
528 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
529 }
530
531 void Start(Param par = null)
532 {
533 OnStart(par);
534 m_IsRunning = true;
535 }
536
537 void Stop(Param par = null)
538 {
540 return;
541
542 OnStop(par);
543 m_IsRunning = false;
544 }
545
546 bool IsRequesterRunning()
547 {
548 return m_IsRunning;
549 }
550
552 void SetRequesterIDX(int idx)
553 {
554 m_IDX = idx;
555 }
556
558 int GetRequesterIDX()
559 {
560 return m_IDX;
561 }
562
564 int GetCategoryMask()
565 {
566 return PPERequesterCategory.NONE;
567 }
568
569 //SETTERS//
570 //vvvvvvv//
571 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
572 {
574 return;
575
577 data.SetPriorityLayer(priority_layer);
578 data.SetInteractionMask(operator);
579
580 data.m_BoolTarget = val;
581 data.m_BoolLast = data.m_BoolCurrent;
582
583 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
584 {
585 data.SetSettingDefaultValues(false);
586 data.SetDataActive(true);
587
589 }
590 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
591 }
592
593 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
594 {
595 //TODO - running check and cleanup rework (elsewhere!)
597 return;
598
600 data.m_BoolLast = data.m_BoolCurrent;
601 if (!data.IsSettingDefaultValues())
602 {
603 data.SetSettingDefaultValues(true);
604
606 }
607 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
608 }
609
610 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
611 {
613 return;
614
615 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
616 data.SetPriorityLayer(priority_layer);
617 data.SetInteractionMask(operator);
618
619 data.m_IntTarget = val;
620 data.m_IntLast = data.m_IntCurrent;
621 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
622 {
623 data.SetSettingDefaultValues(false);
624 data.SetDataActive(true);
625
627 }
628 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
629 }
630
631 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
632 {
633 //TODO - running check and cleanup rework (elsewhere!)
635 return;
636
637 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
638 data.m_IntLast = data.m_IntCurrent;
639 if (!data.IsSettingDefaultValues())
640 {
641 data.SetSettingDefaultValues(true);
642
644 }
645 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
646 }
647
648 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
649 {
651 return;
652
654 data.SetPriorityLayer(priority_layer);
655 data.SetInteractionMask(operator);
656
657 data.m_FloatFormerTarget = data.m_FloatTarget;
658 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
659 data.m_FloatLast = data.m_FloatCurrent;
660 data.m_FloatStart = data.m_FloatCurrent;
661 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
662 {
663 data.SetSettingDefaultValues(false);
664 data.SetDataActive(true);
665
667 }
668 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
669 }
670
671 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
672 {
673 //TODO - running check and cleanup rework (elsewhere!)
675 return;
676
678 data.m_FloatFormerTarget = data.m_FloatTarget;
679 data.m_FloatLast = data.m_FloatCurrent;
680 data.m_FloatStart = data.m_FloatCurrent;
681 if (!data.IsSettingDefaultValues())
682 {
683 data.SetSettingDefaultValues(true);
684
686 }
687 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
688 }
689
690 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
691 {
693 return;
694
695 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
696 data.SetPriorityLayer(priority_layer);
697 data.SetInteractionMask(operator);
698 data.m_ColorFormerTarget = data.m_ColorTarget;
699
700 data.m_ColorTarget.Copy(val);
701
702 data.m_ColorLast = data.m_ColorCurrent;
703 data.m_ColorStart = data.m_ColorCurrent;
704 //if (data.m_ColorTarget != data.m_ColorCurrent)
705 {
706 data.SetSettingDefaultValues(false);
707 data.SetDataActive(true);
708
710 }
711 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
712 }
713
714 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
715 {
716 //TODO - running check and cleanup rework (elsewhere!)
718 return;
719
720 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
721 data.m_ColorFormerTarget = data.m_ColorTarget;
722 data.m_ColorLast = data.m_ColorCurrent;
723 data.m_ColorStart = data.m_ColorCurrent;
724 if (!data.IsSettingDefaultValues())
725 {
726 data.SetSettingDefaultValues(true);
727
729 }
730 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
731 }
732
733 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
734 {
735 }
736
737 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
738 {
739 }*/
740
741 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
742 {
743 }*/
744
746 protected void QueueValuesSend()
747 {
748 m_ValuesSent = false;
749 //m_IsRunning = true;
751 }
752
755 {
758 {
761 else
762 {
765 }
766 }
767 else
768 {
771 temp_map.Set(param_idx, data);
773 }
774
775 if (!data)
776 Error("GetRequestData | no data found in the structure");
777
778 data.m_Requester = this;
779
780 return data;
781 }
782
783 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
784 {
786 switch (type)
787 {
788 case PPEConstants.VAR_TYPE_BOOL:
790 break;
791
792 case PPEConstants.VAR_TYPE_INT:
793 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
794 break;
795
796 case PPEConstants.VAR_TYPE_FLOAT:
798 break;
799
800 case PPEConstants.VAR_TYPE_COLOR:
801 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
802 break;
803 }
804 return data;
805 }
806
807 // unused?
809 {
811 }
812
813 protected void ClearRequesterData()
814 {
816 }
817
819 {
820 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
821 }
822
823 //EVENTS//
824 //vvvvvv//
825 void OnUpdate(float delta)
826 {
827 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
828
829 if (!m_ValuesSent)
830 {
831 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
832 {
833 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
834 {
835 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
836 }
837 }
838 m_ValuesSent = true;
839 }
841 }
842
843 protected void OnStart(Param par = null)
844 {
846 }
847
849 protected void OnStop(Param par = null)
850 {
851 //DbgPrnt("PPEDebug | " + this + " | OnStop");
854 }
855
857 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
858 {
859 float ret = value;
860 if (!relative) //if not already relative...
861 {
862 switch (var_type)
863 {
864 case PPEConstants.VAR_TYPE_FLOAT:
866 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
867 ret = Math.Clamp(ret, 0.0, 1.0);
868 break;
869 }
870 }
871 //Print("RelativizeValue: " + ret);
872
873 return ret;
874 }
875
877 protected void SetDefaultValuesAll()
878 {
879 //<material<param_id,data>>
881
882 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
883 {
884 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
885 {
886 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
887
888 if (!req_data.IsDataActive())
889 continue;
890
891 switch (req_data.GetVarType())
892 {
893 case PPEConstants.VAR_TYPE_BOOL:
894 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
895 break;
896
897 case PPEConstants.VAR_TYPE_INT:
898 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
899 break;
900
901 case PPEConstants.VAR_TYPE_FLOAT:
902 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
903 break;
904
905 case PPEConstants.VAR_TYPE_COLOR:
906 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
907 break;
908 }
909 }
910 }
911 }
912
913 void DbgPrnt(string text)
914 {
915 //Debug.Log(""+text);
916 }
917}
918
920// Base requester platforms //
922
924{
925 override int GetCategoryMask()
926 {
927 return PPERequesterCategory.GAMEPLAY_EFFECTS;
928 }
929}
930
932{
933 override int GetCategoryMask()
934 {
935 return PPERequesterCategory.MENU_EFFECTS;
936 }
937}

◆ IsRequesterRunning()

bool GetCategoryMask::IsRequesterRunning ( )
protected

Definition at line 482 of file PPERequestPlatformsBase.c.

484{
485 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
486 protected bool m_ValuesSent;
487 protected int m_IDX;
488
489 protected bool m_Valid = false;
490
491 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
492
494 {
495 m_Valid = PPERequesterBank.VerifyRequester(this);
496
498 m_ValuesSent = true;
499 m_IsRunning = false;
501 }
502
504 void SetRequesterUpdating(bool state)
505 {
506 if (!m_Valid)
507 {
508 Debug.Log("" + this + " not valid!");
509 return;
510 }
511
512 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
513
514 //TODO - separate into its own function?
515 if (state)
516 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
517 }
518
519 void Start(Param par = null)
520 {
521 OnStart(par);
522 m_IsRunning = true;
523 }
524
525 void Stop(Param par = null)
526 {
528 return;
529
530 OnStop(par);
531 m_IsRunning = false;
532 }
533
534 bool IsRequesterRunning()
535 {
536 return m_IsRunning;
537 }
538
540 void SetRequesterIDX(int idx)
541 {
542 m_IDX = idx;
543 }
544
546 int GetRequesterIDX()
547 {
548 return m_IDX;
549 }
550
552 int GetCategoryMask()
553 {
554 return PPERequesterCategory.NONE;
555 }
556
557 //SETTERS//
558 //vvvvvvv//
559 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
560 {
562 return;
563
565 data.SetPriorityLayer(priority_layer);
566 data.SetInteractionMask(operator);
567
568 data.m_BoolTarget = val;
569 data.m_BoolLast = data.m_BoolCurrent;
570
571 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
572 {
573 data.SetSettingDefaultValues(false);
574 data.SetDataActive(true);
575
577 }
578 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
579 }
580
581 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
582 {
583 //TODO - running check and cleanup rework (elsewhere!)
585 return;
586
588 data.m_BoolLast = data.m_BoolCurrent;
589 if (!data.IsSettingDefaultValues())
590 {
591 data.SetSettingDefaultValues(true);
592
594 }
595 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
596 }
597
598 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
599 {
601 return;
602
603 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
604 data.SetPriorityLayer(priority_layer);
605 data.SetInteractionMask(operator);
606
607 data.m_IntTarget = val;
608 data.m_IntLast = data.m_IntCurrent;
609 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
610 {
611 data.SetSettingDefaultValues(false);
612 data.SetDataActive(true);
613
615 }
616 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
617 }
618
619 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
620 {
621 //TODO - running check and cleanup rework (elsewhere!)
623 return;
624
625 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
626 data.m_IntLast = data.m_IntCurrent;
627 if (!data.IsSettingDefaultValues())
628 {
629 data.SetSettingDefaultValues(true);
630
632 }
633 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
634 }
635
636 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
637 {
639 return;
640
642 data.SetPriorityLayer(priority_layer);
643 data.SetInteractionMask(operator);
644
645 data.m_FloatFormerTarget = data.m_FloatTarget;
646 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
647 data.m_FloatLast = data.m_FloatCurrent;
648 data.m_FloatStart = data.m_FloatCurrent;
649 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
650 {
651 data.SetSettingDefaultValues(false);
652 data.SetDataActive(true);
653
655 }
656 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
657 }
658
659 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
660 {
661 //TODO - running check and cleanup rework (elsewhere!)
663 return;
664
666 data.m_FloatFormerTarget = data.m_FloatTarget;
667 data.m_FloatLast = data.m_FloatCurrent;
668 data.m_FloatStart = data.m_FloatCurrent;
669 if (!data.IsSettingDefaultValues())
670 {
671 data.SetSettingDefaultValues(true);
672
674 }
675 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
676 }
677
678 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
679 {
681 return;
682
683 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
684 data.SetPriorityLayer(priority_layer);
685 data.SetInteractionMask(operator);
686 data.m_ColorFormerTarget = data.m_ColorTarget;
687
688 data.m_ColorTarget.Copy(val);
689
690 data.m_ColorLast = data.m_ColorCurrent;
691 data.m_ColorStart = data.m_ColorCurrent;
692 //if (data.m_ColorTarget != data.m_ColorCurrent)
693 {
694 data.SetSettingDefaultValues(false);
695 data.SetDataActive(true);
696
698 }
699 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
700 }
701
702 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
703 {
704 //TODO - running check and cleanup rework (elsewhere!)
706 return;
707
708 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
709 data.m_ColorFormerTarget = data.m_ColorTarget;
710 data.m_ColorLast = data.m_ColorCurrent;
711 data.m_ColorStart = data.m_ColorCurrent;
712 if (!data.IsSettingDefaultValues())
713 {
714 data.SetSettingDefaultValues(true);
715
717 }
718 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
719 }
720
721 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
722 {
723 }
724
725 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
726 {
727 }*/
728
729 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
730 {
731 }*/
732
734 protected void QueueValuesSend()
735 {
736 m_ValuesSent = false;
737 //m_IsRunning = true;
739 }
740
743 {
746 {
749 else
750 {
753 }
754 }
755 else
756 {
759 temp_map.Set(param_idx, data);
761 }
762
763 if (!data)
764 Error("GetRequestData | no data found in the structure");
765
766 data.m_Requester = this;
767
768 return data;
769 }
770
771 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
772 {
774 switch (type)
775 {
776 case PPEConstants.VAR_TYPE_BOOL:
778 break;
779
780 case PPEConstants.VAR_TYPE_INT:
781 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
782 break;
783
784 case PPEConstants.VAR_TYPE_FLOAT:
786 break;
787
788 case PPEConstants.VAR_TYPE_COLOR:
789 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
790 break;
791 }
792 return data;
793 }
794
795 // unused?
797 {
799 }
800
801 protected void ClearRequesterData()
802 {
804 }
805
807 {
808 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
809 }
810
811 //EVENTS//
812 //vvvvvv//
813 void OnUpdate(float delta)
814 {
815 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
816
817 if (!m_ValuesSent)
818 {
819 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
820 {
821 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
822 {
823 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
824 }
825 }
826 m_ValuesSent = true;
827 }
829 }
830
831 protected void OnStart(Param par = null)
832 {
834 }
835
837 protected void OnStop(Param par = null)
838 {
839 //DbgPrnt("PPEDebug | " + this + " | OnStop");
842 }
843
845 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
846 {
847 float ret = value;
848 if (!relative) //if not already relative...
849 {
850 switch (var_type)
851 {
852 case PPEConstants.VAR_TYPE_FLOAT:
854 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
855 ret = Math.Clamp(ret, 0.0, 1.0);
856 break;
857 }
858 }
859 //Print("RelativizeValue: " + ret);
860
861 return ret;
862 }
863
865 protected void SetDefaultValuesAll()
866 {
867 //<material<param_id,data>>
869
870 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
871 {
872 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
873 {
874 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
875
876 if (!req_data.IsDataActive())
877 continue;
878
879 switch (req_data.GetVarType())
880 {
881 case PPEConstants.VAR_TYPE_BOOL:
882 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
883 break;
884
885 case PPEConstants.VAR_TYPE_INT:
886 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
887 break;
888
889 case PPEConstants.VAR_TYPE_FLOAT:
890 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
891 break;
892
893 case PPEConstants.VAR_TYPE_COLOR:
894 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
895 break;
896 }
897 }
898 }
899 }
900
901 void DbgPrnt(string text)
902 {
903 //Debug.Log(""+text);
904 }
905}
906
908// Base requester platforms //
910
912{
913 override int GetCategoryMask()
914 {
915 return PPERequesterCategory.GAMEPLAY_EFFECTS;
916 }
917}
918
920{
921 override int GetCategoryMask()
922 {
923 return PPERequesterCategory.MENU_EFFECTS;
924 }
925}

◆ OnStart()

void OnStart ( Param par = null)
protected

Definition at line 779 of file PPERequestPlatformsBase.c.

781{
782 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
783 protected bool m_ValuesSent;
784 protected int m_IDX;
785
786 protected bool m_Valid = false;
787
788 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
789
791 {
792 m_Valid = PPERequesterBank.VerifyRequester(this);
793
795 m_ValuesSent = true;
796 m_IsRunning = false;
798 }
799
801 void SetRequesterUpdating(bool state)
802 {
803 if (!m_Valid)
804 {
805 Debug.Log("" + this + " not valid!");
806 return;
807 }
808
809 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
810
811 //TODO - separate into its own function?
812 if (state)
813 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
814 }
815
816 void Start(Param par = null)
817 {
818 OnStart(par);
819 m_IsRunning = true;
820 }
821
822 void Stop(Param par = null)
823 {
825 return;
826
827 OnStop(par);
828 m_IsRunning = false;
829 }
830
831 bool IsRequesterRunning()
832 {
833 return m_IsRunning;
834 }
835
837 void SetRequesterIDX(int idx)
838 {
839 m_IDX = idx;
840 }
841
843 int GetRequesterIDX()
844 {
845 return m_IDX;
846 }
847
849 int GetCategoryMask()
850 {
851 return PPERequesterCategory.NONE;
852 }
853
854 //SETTERS//
855 //vvvvvvv//
856 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
857 {
859 return;
860
862 data.SetPriorityLayer(priority_layer);
863 data.SetInteractionMask(operator);
864
865 data.m_BoolTarget = val;
866 data.m_BoolLast = data.m_BoolCurrent;
867
868 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
869 {
870 data.SetSettingDefaultValues(false);
871 data.SetDataActive(true);
872
874 }
875 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
876 }
877
878 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
879 {
880 //TODO - running check and cleanup rework (elsewhere!)
882 return;
883
885 data.m_BoolLast = data.m_BoolCurrent;
886 if (!data.IsSettingDefaultValues())
887 {
888 data.SetSettingDefaultValues(true);
889
891 }
892 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
893 }
894
895 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
896 {
898 return;
899
900 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
901 data.SetPriorityLayer(priority_layer);
902 data.SetInteractionMask(operator);
903
904 data.m_IntTarget = val;
905 data.m_IntLast = data.m_IntCurrent;
906 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
907 {
908 data.SetSettingDefaultValues(false);
909 data.SetDataActive(true);
910
912 }
913 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
914 }
915
916 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
917 {
918 //TODO - running check and cleanup rework (elsewhere!)
920 return;
921
922 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
923 data.m_IntLast = data.m_IntCurrent;
924 if (!data.IsSettingDefaultValues())
925 {
926 data.SetSettingDefaultValues(true);
927
929 }
930 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
931 }
932
933 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
934 {
936 return;
937
939 data.SetPriorityLayer(priority_layer);
940 data.SetInteractionMask(operator);
941
942 data.m_FloatFormerTarget = data.m_FloatTarget;
943 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
944 data.m_FloatLast = data.m_FloatCurrent;
945 data.m_FloatStart = data.m_FloatCurrent;
946 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
947 {
948 data.SetSettingDefaultValues(false);
949 data.SetDataActive(true);
950
952 }
953 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
954 }
955
956 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
957 {
958 //TODO - running check and cleanup rework (elsewhere!)
960 return;
961
963 data.m_FloatFormerTarget = data.m_FloatTarget;
964 data.m_FloatLast = data.m_FloatCurrent;
965 data.m_FloatStart = data.m_FloatCurrent;
966 if (!data.IsSettingDefaultValues())
967 {
968 data.SetSettingDefaultValues(true);
969
971 }
972 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
973 }
974
975 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
976 {
978 return;
979
980 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
981 data.SetPriorityLayer(priority_layer);
982 data.SetInteractionMask(operator);
983 data.m_ColorFormerTarget = data.m_ColorTarget;
984
985 data.m_ColorTarget.Copy(val);
986
987 data.m_ColorLast = data.m_ColorCurrent;
988 data.m_ColorStart = data.m_ColorCurrent;
989 //if (data.m_ColorTarget != data.m_ColorCurrent)
990 {
991 data.SetSettingDefaultValues(false);
992 data.SetDataActive(true);
993
995 }
996 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
997 }
998
999 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
1000 {
1001 //TODO - running check and cleanup rework (elsewhere!)
1003 return;
1004
1005 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1006 data.m_ColorFormerTarget = data.m_ColorTarget;
1007 data.m_ColorLast = data.m_ColorCurrent;
1008 data.m_ColorStart = data.m_ColorCurrent;
1009 if (!data.IsSettingDefaultValues())
1010 {
1011 data.SetSettingDefaultValues(true);
1012
1014 }
1015 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1016 }
1017
1018 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1019 {
1020 }
1021
1022 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1023 {
1024 }*/
1025
1026 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1027 {
1028 }*/
1029
1031 protected void QueueValuesSend()
1032 {
1033 m_ValuesSent = false;
1034 //m_IsRunning = true;
1036 }
1037
1040 {
1043 {
1046 else
1047 {
1048 data = PrepareData(mat_id, param_idx, type);
1050 }
1051 }
1052 else
1053 {
1054 data = PrepareData(mat_id, param_idx, type);
1056 temp_map.Set(param_idx, data);
1058 }
1059
1060 if (!data)
1061 Error("GetRequestData | no data found in the structure");
1062
1063 data.m_Requester = this;
1064
1065 return data;
1066 }
1067
1068 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1069 {
1071 switch (type)
1072 {
1073 case PPEConstants.VAR_TYPE_BOOL:
1075 break;
1076
1077 case PPEConstants.VAR_TYPE_INT:
1078 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1079 break;
1080
1081 case PPEConstants.VAR_TYPE_FLOAT:
1083 break;
1084
1085 case PPEConstants.VAR_TYPE_COLOR:
1086 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1087 break;
1088 }
1089 return data;
1090 }
1091
1092 // unused?
1094 {
1096 }
1097
1098 protected void ClearRequesterData()
1099 {
1100 m_RequestDataStructure.Clear();
1101 }
1102
1104 {
1105 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1106 }
1107
1108 //EVENTS//
1109 //vvvvvv//
1110 void OnUpdate(float delta)
1111 {
1112 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1113
1114 if (!m_ValuesSent)
1115 {
1116 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1117 {
1118 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1119 {
1120 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1121 }
1122 }
1123 m_ValuesSent = true;
1124 }
1125 SetRequesterUpdating(false);
1126 }
1127
1128 protected void OnStart(Param par = null)
1129 {
1131 }
1132
1134 protected void OnStop(Param par = null)
1135 {
1136 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1139 }
1140
1142 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1143 {
1144 float ret = value;
1145 if (!relative) //if not already relative...
1146 {
1147 switch (var_type)
1148 {
1149 case PPEConstants.VAR_TYPE_FLOAT:
1151 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1152 ret = Math.Clamp(ret, 0.0, 1.0);
1153 break;
1154 }
1155 }
1156 //Print("RelativizeValue: " + ret);
1157
1158 return ret;
1159 }
1160
1162 protected void SetDefaultValuesAll()
1163 {
1164 //<material<param_id,data>>
1166
1167 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1168 {
1169 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1170 {
1171 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1172
1173 if (!req_data.IsDataActive())
1174 continue;
1175
1176 switch (req_data.GetVarType())
1177 {
1178 case PPEConstants.VAR_TYPE_BOOL:
1179 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1180 break;
1181
1182 case PPEConstants.VAR_TYPE_INT:
1183 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1184 break;
1185
1186 case PPEConstants.VAR_TYPE_FLOAT:
1187 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1188 break;
1189
1190 case PPEConstants.VAR_TYPE_COLOR:
1191 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1192 break;
1193 }
1194 }
1195 }
1196 }
1197
1198 void DbgPrnt(string text)
1199 {
1200 //Debug.Log(""+text);
1201 }
1202}
1203
1205// Base requester platforms //
1207
1209{
1210 override int GetCategoryMask()
1211 {
1212 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1213 }
1214}
1215
1217{
1218 override int GetCategoryMask()
1219 {
1220 return PPERequesterCategory.MENU_EFFECTS;
1221 }
1222}

Referenced by TimerBase::Run(), and Start().

◆ OnStop()

void GetCategoryMask::OnStop ( Param par = null)
protected

automatically resets all material parameters of this requester to defaults

Definition at line 785 of file PPERequestPlatformsBase.c.

787{
788 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
789 protected bool m_ValuesSent;
790 protected int m_IDX;
791
792 protected bool m_Valid = false;
793
794 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
795
797 {
798 m_Valid = PPERequesterBank.VerifyRequester(this);
799
801 m_ValuesSent = true;
802 m_IsRunning = false;
804 }
805
807 void SetRequesterUpdating(bool state)
808 {
809 if (!m_Valid)
810 {
811 Debug.Log("" + this + " not valid!");
812 return;
813 }
814
815 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
816
817 //TODO - separate into its own function?
818 if (state)
819 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
820 }
821
822 void Start(Param par = null)
823 {
824 OnStart(par);
825 m_IsRunning = true;
826 }
827
828 void Stop(Param par = null)
829 {
831 return;
832
833 OnStop(par);
834 m_IsRunning = false;
835 }
836
837 bool IsRequesterRunning()
838 {
839 return m_IsRunning;
840 }
841
843 void SetRequesterIDX(int idx)
844 {
845 m_IDX = idx;
846 }
847
849 int GetRequesterIDX()
850 {
851 return m_IDX;
852 }
853
855 int GetCategoryMask()
856 {
857 return PPERequesterCategory.NONE;
858 }
859
860 //SETTERS//
861 //vvvvvvv//
862 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
863 {
865 return;
866
868 data.SetPriorityLayer(priority_layer);
869 data.SetInteractionMask(operator);
870
871 data.m_BoolTarget = val;
872 data.m_BoolLast = data.m_BoolCurrent;
873
874 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
875 {
876 data.SetSettingDefaultValues(false);
877 data.SetDataActive(true);
878
880 }
881 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
882 }
883
884 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
885 {
886 //TODO - running check and cleanup rework (elsewhere!)
888 return;
889
891 data.m_BoolLast = data.m_BoolCurrent;
892 if (!data.IsSettingDefaultValues())
893 {
894 data.SetSettingDefaultValues(true);
895
897 }
898 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
899 }
900
901 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
902 {
904 return;
905
906 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
907 data.SetPriorityLayer(priority_layer);
908 data.SetInteractionMask(operator);
909
910 data.m_IntTarget = val;
911 data.m_IntLast = data.m_IntCurrent;
912 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
913 {
914 data.SetSettingDefaultValues(false);
915 data.SetDataActive(true);
916
918 }
919 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
920 }
921
922 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
923 {
924 //TODO - running check and cleanup rework (elsewhere!)
926 return;
927
928 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
929 data.m_IntLast = data.m_IntCurrent;
930 if (!data.IsSettingDefaultValues())
931 {
932 data.SetSettingDefaultValues(true);
933
935 }
936 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
937 }
938
939 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
940 {
942 return;
943
945 data.SetPriorityLayer(priority_layer);
946 data.SetInteractionMask(operator);
947
948 data.m_FloatFormerTarget = data.m_FloatTarget;
949 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
950 data.m_FloatLast = data.m_FloatCurrent;
951 data.m_FloatStart = data.m_FloatCurrent;
952 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
953 {
954 data.SetSettingDefaultValues(false);
955 data.SetDataActive(true);
956
958 }
959 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
960 }
961
962 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
963 {
964 //TODO - running check and cleanup rework (elsewhere!)
966 return;
967
969 data.m_FloatFormerTarget = data.m_FloatTarget;
970 data.m_FloatLast = data.m_FloatCurrent;
971 data.m_FloatStart = data.m_FloatCurrent;
972 if (!data.IsSettingDefaultValues())
973 {
974 data.SetSettingDefaultValues(true);
975
977 }
978 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
979 }
980
981 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
982 {
984 return;
985
986 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
987 data.SetPriorityLayer(priority_layer);
988 data.SetInteractionMask(operator);
989 data.m_ColorFormerTarget = data.m_ColorTarget;
990
991 data.m_ColorTarget.Copy(val);
992
993 data.m_ColorLast = data.m_ColorCurrent;
994 data.m_ColorStart = data.m_ColorCurrent;
995 //if (data.m_ColorTarget != data.m_ColorCurrent)
996 {
997 data.SetSettingDefaultValues(false);
998 data.SetDataActive(true);
999
1001 }
1002 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1003 }
1004
1005 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
1006 {
1007 //TODO - running check and cleanup rework (elsewhere!)
1009 return;
1010
1011 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1012 data.m_ColorFormerTarget = data.m_ColorTarget;
1013 data.m_ColorLast = data.m_ColorCurrent;
1014 data.m_ColorStart = data.m_ColorCurrent;
1015 if (!data.IsSettingDefaultValues())
1016 {
1017 data.SetSettingDefaultValues(true);
1018
1020 }
1021 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1022 }
1023
1024 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1025 {
1026 }
1027
1028 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1029 {
1030 }*/
1031
1032 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1033 {
1034 }*/
1035
1037 protected void QueueValuesSend()
1038 {
1039 m_ValuesSent = false;
1040 //m_IsRunning = true;
1042 }
1043
1046 {
1049 {
1052 else
1053 {
1054 data = PrepareData(mat_id, param_idx, type);
1056 }
1057 }
1058 else
1059 {
1060 data = PrepareData(mat_id, param_idx, type);
1062 temp_map.Set(param_idx, data);
1064 }
1065
1066 if (!data)
1067 Error("GetRequestData | no data found in the structure");
1068
1069 data.m_Requester = this;
1070
1071 return data;
1072 }
1073
1074 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1075 {
1077 switch (type)
1078 {
1079 case PPEConstants.VAR_TYPE_BOOL:
1081 break;
1082
1083 case PPEConstants.VAR_TYPE_INT:
1084 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1085 break;
1086
1087 case PPEConstants.VAR_TYPE_FLOAT:
1089 break;
1090
1091 case PPEConstants.VAR_TYPE_COLOR:
1092 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1093 break;
1094 }
1095 return data;
1096 }
1097
1098 // unused?
1100 {
1102 }
1103
1104 protected void ClearRequesterData()
1105 {
1106 m_RequestDataStructure.Clear();
1107 }
1108
1110 {
1111 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1112 }
1113
1114 //EVENTS//
1115 //vvvvvv//
1116 void OnUpdate(float delta)
1117 {
1118 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1119
1120 if (!m_ValuesSent)
1121 {
1122 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1123 {
1124 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1125 {
1126 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1127 }
1128 }
1129 m_ValuesSent = true;
1130 }
1131 SetRequesterUpdating(false);
1132 }
1133
1134 protected void OnStart(Param par = null)
1135 {
1137 }
1138
1140 protected void OnStop(Param par = null)
1141 {
1142 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1145 }
1146
1148 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1149 {
1150 float ret = value;
1151 if (!relative) //if not already relative...
1152 {
1153 switch (var_type)
1154 {
1155 case PPEConstants.VAR_TYPE_FLOAT:
1157 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1158 ret = Math.Clamp(ret, 0.0, 1.0);
1159 break;
1160 }
1161 }
1162 //Print("RelativizeValue: " + ret);
1163
1164 return ret;
1165 }
1166
1168 protected void SetDefaultValuesAll()
1169 {
1170 //<material<param_id,data>>
1172
1173 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1174 {
1175 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1176 {
1177 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1178
1179 if (!req_data.IsDataActive())
1180 continue;
1181
1182 switch (req_data.GetVarType())
1183 {
1184 case PPEConstants.VAR_TYPE_BOOL:
1185 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1186 break;
1187
1188 case PPEConstants.VAR_TYPE_INT:
1189 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1190 break;
1191
1192 case PPEConstants.VAR_TYPE_FLOAT:
1193 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1194 break;
1195
1196 case PPEConstants.VAR_TYPE_COLOR:
1197 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1198 break;
1199 }
1200 }
1201 }
1202 }
1203
1204 void DbgPrnt(string text)
1205 {
1206 //Debug.Log(""+text);
1207 }
1208}
1209
1211// Base requester platforms //
1213
1215{
1216 override int GetCategoryMask()
1217 {
1218 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1219 }
1220}
1221
1223{
1224 override int GetCategoryMask()
1225 {
1226 return PPERequesterCategory.MENU_EFFECTS;
1227 }
1228}

◆ OnUpdate()

void GetCategoryMask::OnUpdate ( float delta)
protected

Definition at line 761 of file PPERequestPlatformsBase.c.

763{
764 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
765 protected bool m_ValuesSent;
766 protected int m_IDX;
767
768 protected bool m_Valid = false;
769
770 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
771
773 {
774 m_Valid = PPERequesterBank.VerifyRequester(this);
775
777 m_ValuesSent = true;
778 m_IsRunning = false;
780 }
781
783 void SetRequesterUpdating(bool state)
784 {
785 if (!m_Valid)
786 {
787 Debug.Log("" + this + " not valid!");
788 return;
789 }
790
791 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
792
793 //TODO - separate into its own function?
794 if (state)
795 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
796 }
797
798 void Start(Param par = null)
799 {
800 OnStart(par);
801 m_IsRunning = true;
802 }
803
804 void Stop(Param par = null)
805 {
807 return;
808
809 OnStop(par);
810 m_IsRunning = false;
811 }
812
813 bool IsRequesterRunning()
814 {
815 return m_IsRunning;
816 }
817
819 void SetRequesterIDX(int idx)
820 {
821 m_IDX = idx;
822 }
823
825 int GetRequesterIDX()
826 {
827 return m_IDX;
828 }
829
831 int GetCategoryMask()
832 {
833 return PPERequesterCategory.NONE;
834 }
835
836 //SETTERS//
837 //vvvvvvv//
838 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
839 {
841 return;
842
844 data.SetPriorityLayer(priority_layer);
845 data.SetInteractionMask(operator);
846
847 data.m_BoolTarget = val;
848 data.m_BoolLast = data.m_BoolCurrent;
849
850 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
851 {
852 data.SetSettingDefaultValues(false);
853 data.SetDataActive(true);
854
856 }
857 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
858 }
859
860 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
861 {
862 //TODO - running check and cleanup rework (elsewhere!)
864 return;
865
867 data.m_BoolLast = data.m_BoolCurrent;
868 if (!data.IsSettingDefaultValues())
869 {
870 data.SetSettingDefaultValues(true);
871
873 }
874 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
875 }
876
877 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
878 {
880 return;
881
882 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
883 data.SetPriorityLayer(priority_layer);
884 data.SetInteractionMask(operator);
885
886 data.m_IntTarget = val;
887 data.m_IntLast = data.m_IntCurrent;
888 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
889 {
890 data.SetSettingDefaultValues(false);
891 data.SetDataActive(true);
892
894 }
895 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
896 }
897
898 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
899 {
900 //TODO - running check and cleanup rework (elsewhere!)
902 return;
903
904 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
905 data.m_IntLast = data.m_IntCurrent;
906 if (!data.IsSettingDefaultValues())
907 {
908 data.SetSettingDefaultValues(true);
909
911 }
912 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
913 }
914
915 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
916 {
918 return;
919
921 data.SetPriorityLayer(priority_layer);
922 data.SetInteractionMask(operator);
923
924 data.m_FloatFormerTarget = data.m_FloatTarget;
925 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
926 data.m_FloatLast = data.m_FloatCurrent;
927 data.m_FloatStart = data.m_FloatCurrent;
928 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
929 {
930 data.SetSettingDefaultValues(false);
931 data.SetDataActive(true);
932
934 }
935 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
936 }
937
938 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
939 {
940 //TODO - running check and cleanup rework (elsewhere!)
942 return;
943
945 data.m_FloatFormerTarget = data.m_FloatTarget;
946 data.m_FloatLast = data.m_FloatCurrent;
947 data.m_FloatStart = data.m_FloatCurrent;
948 if (!data.IsSettingDefaultValues())
949 {
950 data.SetSettingDefaultValues(true);
951
953 }
954 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
955 }
956
957 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
958 {
960 return;
961
962 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
963 data.SetPriorityLayer(priority_layer);
964 data.SetInteractionMask(operator);
965 data.m_ColorFormerTarget = data.m_ColorTarget;
966
967 data.m_ColorTarget.Copy(val);
968
969 data.m_ColorLast = data.m_ColorCurrent;
970 data.m_ColorStart = data.m_ColorCurrent;
971 //if (data.m_ColorTarget != data.m_ColorCurrent)
972 {
973 data.SetSettingDefaultValues(false);
974 data.SetDataActive(true);
975
977 }
978 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
979 }
980
981 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
982 {
983 //TODO - running check and cleanup rework (elsewhere!)
985 return;
986
987 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
988 data.m_ColorFormerTarget = data.m_ColorTarget;
989 data.m_ColorLast = data.m_ColorCurrent;
990 data.m_ColorStart = data.m_ColorCurrent;
991 if (!data.IsSettingDefaultValues())
992 {
993 data.SetSettingDefaultValues(true);
994
996 }
997 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
998 }
999
1000 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1001 {
1002 }
1003
1004 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1005 {
1006 }*/
1007
1008 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1009 {
1010 }*/
1011
1013 protected void QueueValuesSend()
1014 {
1015 m_ValuesSent = false;
1016 //m_IsRunning = true;
1018 }
1019
1022 {
1025 {
1028 else
1029 {
1030 data = PrepareData(mat_id, param_idx, type);
1032 }
1033 }
1034 else
1035 {
1036 data = PrepareData(mat_id, param_idx, type);
1038 temp_map.Set(param_idx, data);
1040 }
1041
1042 if (!data)
1043 Error("GetRequestData | no data found in the structure");
1044
1045 data.m_Requester = this;
1046
1047 return data;
1048 }
1049
1050 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1051 {
1053 switch (type)
1054 {
1055 case PPEConstants.VAR_TYPE_BOOL:
1057 break;
1058
1059 case PPEConstants.VAR_TYPE_INT:
1060 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1061 break;
1062
1063 case PPEConstants.VAR_TYPE_FLOAT:
1065 break;
1066
1067 case PPEConstants.VAR_TYPE_COLOR:
1068 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1069 break;
1070 }
1071 return data;
1072 }
1073
1074 // unused?
1076 {
1078 }
1079
1080 protected void ClearRequesterData()
1081 {
1082 m_RequestDataStructure.Clear();
1083 }
1084
1086 {
1087 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1088 }
1089
1090 //EVENTS//
1091 //vvvvvv//
1092 void OnUpdate(float delta)
1093 {
1094 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1095
1096 if (!m_ValuesSent)
1097 {
1098 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1099 {
1100 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1101 {
1102 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1103 }
1104 }
1105 m_ValuesSent = true;
1106 }
1107 SetRequesterUpdating(false);
1108 }
1109
1110 protected void OnStart(Param par = null)
1111 {
1113 }
1114
1116 protected void OnStop(Param par = null)
1117 {
1118 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1121 }
1122
1124 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1125 {
1126 float ret = value;
1127 if (!relative) //if not already relative...
1128 {
1129 switch (var_type)
1130 {
1131 case PPEConstants.VAR_TYPE_FLOAT:
1133 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1134 ret = Math.Clamp(ret, 0.0, 1.0);
1135 break;
1136 }
1137 }
1138 //Print("RelativizeValue: " + ret);
1139
1140 return ret;
1141 }
1142
1144 protected void SetDefaultValuesAll()
1145 {
1146 //<material<param_id,data>>
1148
1149 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1150 {
1151 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1152 {
1153 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1154
1155 if (!req_data.IsDataActive())
1156 continue;
1157
1158 switch (req_data.GetVarType())
1159 {
1160 case PPEConstants.VAR_TYPE_BOOL:
1161 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1162 break;
1163
1164 case PPEConstants.VAR_TYPE_INT:
1165 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1166 break;
1167
1168 case PPEConstants.VAR_TYPE_FLOAT:
1169 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1170 break;
1171
1172 case PPEConstants.VAR_TYPE_COLOR:
1173 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1174 break;
1175 }
1176 }
1177 }
1178 }
1179
1180 void DbgPrnt(string text)
1181 {
1182 //Debug.Log(""+text);
1183 }
1184}
1185
1187// Base requester platforms //
1189
1191{
1192 override int GetCategoryMask()
1193 {
1194 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1195 }
1196}
1197
1199{
1200 override int GetCategoryMask()
1201 {
1202 return PPERequesterCategory.MENU_EFFECTS;
1203 }
1204}

◆ PPERequesterBase()

void GetCategoryMask::PPERequesterBase ( int requester_IDX)
protected

Definition at line 441 of file PPERequestPlatformsBase.c.

441 {
442 return PPERequesterCategory.MENU_EFFECTS;
443 }
444}

◆ PrepareData()

PPERequestParamDataBase GetCategoryMask::PrepareData ( int mat_id,
int param_idx,
int type )
protected

Definition at line 719 of file PPERequestPlatformsBase.c.

721{
722 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
723 protected bool m_ValuesSent;
724 protected int m_IDX;
725
726 protected bool m_Valid = false;
727
728 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
729
731 {
732 m_Valid = PPERequesterBank.VerifyRequester(this);
733
735 m_ValuesSent = true;
736 m_IsRunning = false;
738 }
739
741 void SetRequesterUpdating(bool state)
742 {
743 if (!m_Valid)
744 {
745 Debug.Log("" + this + " not valid!");
746 return;
747 }
748
749 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
750
751 //TODO - separate into its own function?
752 if (state)
753 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
754 }
755
756 void Start(Param par = null)
757 {
758 OnStart(par);
759 m_IsRunning = true;
760 }
761
762 void Stop(Param par = null)
763 {
765 return;
766
767 OnStop(par);
768 m_IsRunning = false;
769 }
770
771 bool IsRequesterRunning()
772 {
773 return m_IsRunning;
774 }
775
777 void SetRequesterIDX(int idx)
778 {
779 m_IDX = idx;
780 }
781
783 int GetRequesterIDX()
784 {
785 return m_IDX;
786 }
787
789 int GetCategoryMask()
790 {
791 return PPERequesterCategory.NONE;
792 }
793
794 //SETTERS//
795 //vvvvvvv//
796 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
797 {
799 return;
800
802 data.SetPriorityLayer(priority_layer);
803 data.SetInteractionMask(operator);
804
805 data.m_BoolTarget = val;
806 data.m_BoolLast = data.m_BoolCurrent;
807
808 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
809 {
810 data.SetSettingDefaultValues(false);
811 data.SetDataActive(true);
812
814 }
815 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
816 }
817
818 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
819 {
820 //TODO - running check and cleanup rework (elsewhere!)
822 return;
823
825 data.m_BoolLast = data.m_BoolCurrent;
826 if (!data.IsSettingDefaultValues())
827 {
828 data.SetSettingDefaultValues(true);
829
831 }
832 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
833 }
834
835 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
836 {
838 return;
839
840 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
841 data.SetPriorityLayer(priority_layer);
842 data.SetInteractionMask(operator);
843
844 data.m_IntTarget = val;
845 data.m_IntLast = data.m_IntCurrent;
846 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
847 {
848 data.SetSettingDefaultValues(false);
849 data.SetDataActive(true);
850
852 }
853 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
854 }
855
856 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
857 {
858 //TODO - running check and cleanup rework (elsewhere!)
860 return;
861
862 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
863 data.m_IntLast = data.m_IntCurrent;
864 if (!data.IsSettingDefaultValues())
865 {
866 data.SetSettingDefaultValues(true);
867
869 }
870 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
871 }
872
873 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
874 {
876 return;
877
879 data.SetPriorityLayer(priority_layer);
880 data.SetInteractionMask(operator);
881
882 data.m_FloatFormerTarget = data.m_FloatTarget;
883 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
884 data.m_FloatLast = data.m_FloatCurrent;
885 data.m_FloatStart = data.m_FloatCurrent;
886 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
887 {
888 data.SetSettingDefaultValues(false);
889 data.SetDataActive(true);
890
892 }
893 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
894 }
895
896 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
897 {
898 //TODO - running check and cleanup rework (elsewhere!)
900 return;
901
903 data.m_FloatFormerTarget = data.m_FloatTarget;
904 data.m_FloatLast = data.m_FloatCurrent;
905 data.m_FloatStart = data.m_FloatCurrent;
906 if (!data.IsSettingDefaultValues())
907 {
908 data.SetSettingDefaultValues(true);
909
911 }
912 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
913 }
914
915 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
916 {
918 return;
919
920 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
921 data.SetPriorityLayer(priority_layer);
922 data.SetInteractionMask(operator);
923 data.m_ColorFormerTarget = data.m_ColorTarget;
924
925 data.m_ColorTarget.Copy(val);
926
927 data.m_ColorLast = data.m_ColorCurrent;
928 data.m_ColorStart = data.m_ColorCurrent;
929 //if (data.m_ColorTarget != data.m_ColorCurrent)
930 {
931 data.SetSettingDefaultValues(false);
932 data.SetDataActive(true);
933
935 }
936 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
937 }
938
939 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
940 {
941 //TODO - running check and cleanup rework (elsewhere!)
943 return;
944
945 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
946 data.m_ColorFormerTarget = data.m_ColorTarget;
947 data.m_ColorLast = data.m_ColorCurrent;
948 data.m_ColorStart = data.m_ColorCurrent;
949 if (!data.IsSettingDefaultValues())
950 {
951 data.SetSettingDefaultValues(true);
952
954 }
955 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
956 }
957
958 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
959 {
960 }
961
962 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
963 {
964 }*/
965
966 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
967 {
968 }*/
969
971 protected void QueueValuesSend()
972 {
973 m_ValuesSent = false;
974 //m_IsRunning = true;
976 }
977
980 {
983 {
986 else
987 {
990 }
991 }
992 else
993 {
996 temp_map.Set(param_idx, data);
998 }
999
1000 if (!data)
1001 Error("GetRequestData | no data found in the structure");
1002
1003 data.m_Requester = this;
1004
1005 return data;
1006 }
1007
1008 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1009 {
1011 switch (type)
1012 {
1013 case PPEConstants.VAR_TYPE_BOOL:
1015 break;
1016
1017 case PPEConstants.VAR_TYPE_INT:
1018 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1019 break;
1020
1021 case PPEConstants.VAR_TYPE_FLOAT:
1023 break;
1024
1025 case PPEConstants.VAR_TYPE_COLOR:
1026 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1027 break;
1028 }
1029 return data;
1030 }
1031
1032 // unused?
1034 {
1036 }
1037
1038 protected void ClearRequesterData()
1039 {
1040 m_RequestDataStructure.Clear();
1041 }
1042
1044 {
1045 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1046 }
1047
1048 //EVENTS//
1049 //vvvvvv//
1050 void OnUpdate(float delta)
1051 {
1052 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1053
1054 if (!m_ValuesSent)
1055 {
1056 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1057 {
1058 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1059 {
1060 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1061 }
1062 }
1063 m_ValuesSent = true;
1064 }
1065 SetRequesterUpdating(false);
1066 }
1067
1068 protected void OnStart(Param par = null)
1069 {
1071 }
1072
1074 protected void OnStop(Param par = null)
1075 {
1076 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1079 }
1080
1082 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1083 {
1084 float ret = value;
1085 if (!relative) //if not already relative...
1086 {
1087 switch (var_type)
1088 {
1089 case PPEConstants.VAR_TYPE_FLOAT:
1091 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1092 ret = Math.Clamp(ret, 0.0, 1.0);
1093 break;
1094 }
1095 }
1096 //Print("RelativizeValue: " + ret);
1097
1098 return ret;
1099 }
1100
1102 protected void SetDefaultValuesAll()
1103 {
1104 //<material<param_id,data>>
1106
1107 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1108 {
1109 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1110 {
1111 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1112
1113 if (!req_data.IsDataActive())
1114 continue;
1115
1116 switch (req_data.GetVarType())
1117 {
1118 case PPEConstants.VAR_TYPE_BOOL:
1119 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1120 break;
1121
1122 case PPEConstants.VAR_TYPE_INT:
1123 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1124 break;
1125
1126 case PPEConstants.VAR_TYPE_FLOAT:
1127 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1128 break;
1129
1130 case PPEConstants.VAR_TYPE_COLOR:
1131 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1132 break;
1133 }
1134 }
1135 }
1136 }
1137
1138 void DbgPrnt(string text)
1139 {
1140 //Debug.Log(""+text);
1141 }
1142}
1143
1145// Base requester platforms //
1147
1149{
1150 override int GetCategoryMask()
1151 {
1152 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1153 }
1154}
1155
1157{
1158 override int GetCategoryMask()
1159 {
1160 return PPERequesterCategory.MENU_EFFECTS;
1161 }
1162}

◆ QueueValuesSend()

void GetCategoryMask::QueueValuesSend ( )
protected

Sets this requester to update in the manager.

Definition at line 682 of file PPERequestPlatformsBase.c.

684{
685 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
686 protected bool m_ValuesSent;
687 protected int m_IDX;
688
689 protected bool m_Valid = false;
690
691 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
692
694 {
695 m_Valid = PPERequesterBank.VerifyRequester(this);
696
698 m_ValuesSent = true;
699 m_IsRunning = false;
701 }
702
704 void SetRequesterUpdating(bool state)
705 {
706 if (!m_Valid)
707 {
708 Debug.Log("" + this + " not valid!");
709 return;
710 }
711
712 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
713
714 //TODO - separate into its own function?
715 if (state)
716 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
717 }
718
719 void Start(Param par = null)
720 {
721 OnStart(par);
722 m_IsRunning = true;
723 }
724
725 void Stop(Param par = null)
726 {
728 return;
729
730 OnStop(par);
731 m_IsRunning = false;
732 }
733
734 bool IsRequesterRunning()
735 {
736 return m_IsRunning;
737 }
738
740 void SetRequesterIDX(int idx)
741 {
742 m_IDX = idx;
743 }
744
746 int GetRequesterIDX()
747 {
748 return m_IDX;
749 }
750
752 int GetCategoryMask()
753 {
754 return PPERequesterCategory.NONE;
755 }
756
757 //SETTERS//
758 //vvvvvvv//
759 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
760 {
762 return;
763
765 data.SetPriorityLayer(priority_layer);
766 data.SetInteractionMask(operator);
767
768 data.m_BoolTarget = val;
769 data.m_BoolLast = data.m_BoolCurrent;
770
771 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
772 {
773 data.SetSettingDefaultValues(false);
774 data.SetDataActive(true);
775
777 }
778 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
779 }
780
781 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
782 {
783 //TODO - running check and cleanup rework (elsewhere!)
785 return;
786
788 data.m_BoolLast = data.m_BoolCurrent;
789 if (!data.IsSettingDefaultValues())
790 {
791 data.SetSettingDefaultValues(true);
792
794 }
795 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
796 }
797
798 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
799 {
801 return;
802
803 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
804 data.SetPriorityLayer(priority_layer);
805 data.SetInteractionMask(operator);
806
807 data.m_IntTarget = val;
808 data.m_IntLast = data.m_IntCurrent;
809 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
810 {
811 data.SetSettingDefaultValues(false);
812 data.SetDataActive(true);
813
815 }
816 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
817 }
818
819 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
820 {
821 //TODO - running check and cleanup rework (elsewhere!)
823 return;
824
825 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
826 data.m_IntLast = data.m_IntCurrent;
827 if (!data.IsSettingDefaultValues())
828 {
829 data.SetSettingDefaultValues(true);
830
832 }
833 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
834 }
835
836 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
837 {
839 return;
840
842 data.SetPriorityLayer(priority_layer);
843 data.SetInteractionMask(operator);
844
845 data.m_FloatFormerTarget = data.m_FloatTarget;
846 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
847 data.m_FloatLast = data.m_FloatCurrent;
848 data.m_FloatStart = data.m_FloatCurrent;
849 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
850 {
851 data.SetSettingDefaultValues(false);
852 data.SetDataActive(true);
853
855 }
856 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
857 }
858
859 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
860 {
861 //TODO - running check and cleanup rework (elsewhere!)
863 return;
864
866 data.m_FloatFormerTarget = data.m_FloatTarget;
867 data.m_FloatLast = data.m_FloatCurrent;
868 data.m_FloatStart = data.m_FloatCurrent;
869 if (!data.IsSettingDefaultValues())
870 {
871 data.SetSettingDefaultValues(true);
872
874 }
875 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
876 }
877
878 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
879 {
881 return;
882
883 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
884 data.SetPriorityLayer(priority_layer);
885 data.SetInteractionMask(operator);
886 data.m_ColorFormerTarget = data.m_ColorTarget;
887
888 data.m_ColorTarget.Copy(val);
889
890 data.m_ColorLast = data.m_ColorCurrent;
891 data.m_ColorStart = data.m_ColorCurrent;
892 //if (data.m_ColorTarget != data.m_ColorCurrent)
893 {
894 data.SetSettingDefaultValues(false);
895 data.SetDataActive(true);
896
898 }
899 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
900 }
901
902 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
903 {
904 //TODO - running check and cleanup rework (elsewhere!)
906 return;
907
908 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
909 data.m_ColorFormerTarget = data.m_ColorTarget;
910 data.m_ColorLast = data.m_ColorCurrent;
911 data.m_ColorStart = data.m_ColorCurrent;
912 if (!data.IsSettingDefaultValues())
913 {
914 data.SetSettingDefaultValues(true);
915
917 }
918 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
919 }
920
921 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
922 {
923 }
924
925 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
926 {
927 }*/
928
929 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
930 {
931 }*/
932
934 protected void QueueValuesSend()
935 {
936 m_ValuesSent = false;
937 //m_IsRunning = true;
939 }
940
943 {
946 {
949 else
950 {
953 }
954 }
955 else
956 {
959 temp_map.Set(param_idx, data);
961 }
962
963 if (!data)
964 Error("GetRequestData | no data found in the structure");
965
966 data.m_Requester = this;
967
968 return data;
969 }
970
971 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
972 {
974 switch (type)
975 {
976 case PPEConstants.VAR_TYPE_BOOL:
978 break;
979
980 case PPEConstants.VAR_TYPE_INT:
981 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
982 break;
983
984 case PPEConstants.VAR_TYPE_FLOAT:
986 break;
987
988 case PPEConstants.VAR_TYPE_COLOR:
989 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
990 break;
991 }
992 return data;
993 }
994
995 // unused?
997 {
999 }
1000
1001 protected void ClearRequesterData()
1002 {
1003 m_RequestDataStructure.Clear();
1004 }
1005
1007 {
1008 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1009 }
1010
1011 //EVENTS//
1012 //vvvvvv//
1013 void OnUpdate(float delta)
1014 {
1015 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1016
1017 if (!m_ValuesSent)
1018 {
1019 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1020 {
1021 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1022 {
1023 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1024 }
1025 }
1026 m_ValuesSent = true;
1027 }
1028 SetRequesterUpdating(false);
1029 }
1030
1031 protected void OnStart(Param par = null)
1032 {
1034 }
1035
1037 protected void OnStop(Param par = null)
1038 {
1039 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1042 }
1043
1045 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1046 {
1047 float ret = value;
1048 if (!relative) //if not already relative...
1049 {
1050 switch (var_type)
1051 {
1052 case PPEConstants.VAR_TYPE_FLOAT:
1054 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1055 ret = Math.Clamp(ret, 0.0, 1.0);
1056 break;
1057 }
1058 }
1059 //Print("RelativizeValue: " + ret);
1060
1061 return ret;
1062 }
1063
1065 protected void SetDefaultValuesAll()
1066 {
1067 //<material<param_id,data>>
1069
1070 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1071 {
1072 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1073 {
1074 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1075
1076 if (!req_data.IsDataActive())
1077 continue;
1078
1079 switch (req_data.GetVarType())
1080 {
1081 case PPEConstants.VAR_TYPE_BOOL:
1082 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1083 break;
1084
1085 case PPEConstants.VAR_TYPE_INT:
1086 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1087 break;
1088
1089 case PPEConstants.VAR_TYPE_FLOAT:
1090 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1091 break;
1092
1093 case PPEConstants.VAR_TYPE_COLOR:
1094 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1095 break;
1096 }
1097 }
1098 }
1099 }
1100
1101 void DbgPrnt(string text)
1102 {
1103 //Debug.Log(""+text);
1104 }
1105}
1106
1108// Base requester platforms //
1110
1112{
1113 override int GetCategoryMask()
1114 {
1115 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1116 }
1117}
1118
1120{
1121 override int GetCategoryMask()
1122 {
1123 return PPERequesterCategory.MENU_EFFECTS;
1124 }
1125}

◆ RelativizeValue()

float GetCategoryMask::RelativizeValue ( float value,
int var_type,
int mat_id,
int param_id,
bool relative )
protected

converts all values used to relative values (if not relative already)

Definition at line 793 of file PPERequestPlatformsBase.c.

795{
796 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
797 protected bool m_ValuesSent;
798 protected int m_IDX;
799
800 protected bool m_Valid = false;
801
802 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
803
805 {
806 m_Valid = PPERequesterBank.VerifyRequester(this);
807
809 m_ValuesSent = true;
810 m_IsRunning = false;
812 }
813
815 void SetRequesterUpdating(bool state)
816 {
817 if (!m_Valid)
818 {
819 Debug.Log("" + this + " not valid!");
820 return;
821 }
822
823 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
824
825 //TODO - separate into its own function?
826 if (state)
827 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
828 }
829
830 void Start(Param par = null)
831 {
832 OnStart(par);
833 m_IsRunning = true;
834 }
835
836 void Stop(Param par = null)
837 {
839 return;
840
841 OnStop(par);
842 m_IsRunning = false;
843 }
844
845 bool IsRequesterRunning()
846 {
847 return m_IsRunning;
848 }
849
851 void SetRequesterIDX(int idx)
852 {
853 m_IDX = idx;
854 }
855
857 int GetRequesterIDX()
858 {
859 return m_IDX;
860 }
861
863 int GetCategoryMask()
864 {
865 return PPERequesterCategory.NONE;
866 }
867
868 //SETTERS//
869 //vvvvvvv//
870 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
871 {
873 return;
874
876 data.SetPriorityLayer(priority_layer);
877 data.SetInteractionMask(operator);
878
879 data.m_BoolTarget = val;
880 data.m_BoolLast = data.m_BoolCurrent;
881
882 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
883 {
884 data.SetSettingDefaultValues(false);
885 data.SetDataActive(true);
886
888 }
889 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
890 }
891
892 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
893 {
894 //TODO - running check and cleanup rework (elsewhere!)
896 return;
897
899 data.m_BoolLast = data.m_BoolCurrent;
900 if (!data.IsSettingDefaultValues())
901 {
902 data.SetSettingDefaultValues(true);
903
905 }
906 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
907 }
908
909 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
910 {
912 return;
913
914 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
915 data.SetPriorityLayer(priority_layer);
916 data.SetInteractionMask(operator);
917
918 data.m_IntTarget = val;
919 data.m_IntLast = data.m_IntCurrent;
920 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
921 {
922 data.SetSettingDefaultValues(false);
923 data.SetDataActive(true);
924
926 }
927 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
928 }
929
930 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
931 {
932 //TODO - running check and cleanup rework (elsewhere!)
934 return;
935
936 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
937 data.m_IntLast = data.m_IntCurrent;
938 if (!data.IsSettingDefaultValues())
939 {
940 data.SetSettingDefaultValues(true);
941
943 }
944 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
945 }
946
947 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
948 {
950 return;
951
953 data.SetPriorityLayer(priority_layer);
954 data.SetInteractionMask(operator);
955
956 data.m_FloatFormerTarget = data.m_FloatTarget;
957 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
958 data.m_FloatLast = data.m_FloatCurrent;
959 data.m_FloatStart = data.m_FloatCurrent;
960 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
961 {
962 data.SetSettingDefaultValues(false);
963 data.SetDataActive(true);
964
966 }
967 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
968 }
969
970 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
971 {
972 //TODO - running check and cleanup rework (elsewhere!)
974 return;
975
977 data.m_FloatFormerTarget = data.m_FloatTarget;
978 data.m_FloatLast = data.m_FloatCurrent;
979 data.m_FloatStart = data.m_FloatCurrent;
980 if (!data.IsSettingDefaultValues())
981 {
982 data.SetSettingDefaultValues(true);
983
985 }
986 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
987 }
988
989 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
990 {
992 return;
993
994 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
995 data.SetPriorityLayer(priority_layer);
996 data.SetInteractionMask(operator);
997 data.m_ColorFormerTarget = data.m_ColorTarget;
998
999 data.m_ColorTarget.Copy(val);
1000
1001 data.m_ColorLast = data.m_ColorCurrent;
1002 data.m_ColorStart = data.m_ColorCurrent;
1003 //if (data.m_ColorTarget != data.m_ColorCurrent)
1004 {
1005 data.SetSettingDefaultValues(false);
1006 data.SetDataActive(true);
1007
1009 }
1010 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1011 }
1012
1013 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
1014 {
1015 //TODO - running check and cleanup rework (elsewhere!)
1017 return;
1018
1019 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1020 data.m_ColorFormerTarget = data.m_ColorTarget;
1021 data.m_ColorLast = data.m_ColorCurrent;
1022 data.m_ColorStart = data.m_ColorCurrent;
1023 if (!data.IsSettingDefaultValues())
1024 {
1025 data.SetSettingDefaultValues(true);
1026
1028 }
1029 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1030 }
1031
1032 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1033 {
1034 }
1035
1036 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1037 {
1038 }*/
1039
1040 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1041 {
1042 }*/
1043
1045 protected void QueueValuesSend()
1046 {
1047 m_ValuesSent = false;
1048 //m_IsRunning = true;
1050 }
1051
1054 {
1057 {
1060 else
1061 {
1062 data = PrepareData(mat_id, param_idx, type);
1064 }
1065 }
1066 else
1067 {
1068 data = PrepareData(mat_id, param_idx, type);
1070 temp_map.Set(param_idx, data);
1072 }
1073
1074 if (!data)
1075 Error("GetRequestData | no data found in the structure");
1076
1077 data.m_Requester = this;
1078
1079 return data;
1080 }
1081
1082 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1083 {
1085 switch (type)
1086 {
1087 case PPEConstants.VAR_TYPE_BOOL:
1089 break;
1090
1091 case PPEConstants.VAR_TYPE_INT:
1092 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1093 break;
1094
1095 case PPEConstants.VAR_TYPE_FLOAT:
1097 break;
1098
1099 case PPEConstants.VAR_TYPE_COLOR:
1100 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1101 break;
1102 }
1103 return data;
1104 }
1105
1106 // unused?
1108 {
1110 }
1111
1112 protected void ClearRequesterData()
1113 {
1114 m_RequestDataStructure.Clear();
1115 }
1116
1118 {
1119 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1120 }
1121
1122 //EVENTS//
1123 //vvvvvv//
1124 void OnUpdate(float delta)
1125 {
1126 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1127
1128 if (!m_ValuesSent)
1129 {
1130 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1131 {
1132 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1133 {
1134 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1135 }
1136 }
1137 m_ValuesSent = true;
1138 }
1139 SetRequesterUpdating(false);
1140 }
1141
1142 protected void OnStart(Param par = null)
1143 {
1145 }
1146
1148 protected void OnStop(Param par = null)
1149 {
1150 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1153 }
1154
1156 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1157 {
1158 float ret = value;
1159 if (!relative) //if not already relative...
1160 {
1161 switch (var_type)
1162 {
1163 case PPEConstants.VAR_TYPE_FLOAT:
1165 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1166 ret = Math.Clamp(ret, 0.0, 1.0);
1167 break;
1168 }
1169 }
1170 //Print("RelativizeValue: " + ret);
1171
1172 return ret;
1173 }
1174
1176 protected void SetDefaultValuesAll()
1177 {
1178 //<material<param_id,data>>
1180
1181 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1182 {
1183 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1184 {
1185 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1186
1187 if (!req_data.IsDataActive())
1188 continue;
1189
1190 switch (req_data.GetVarType())
1191 {
1192 case PPEConstants.VAR_TYPE_BOOL:
1193 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1194 break;
1195
1196 case PPEConstants.VAR_TYPE_INT:
1197 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1198 break;
1199
1200 case PPEConstants.VAR_TYPE_FLOAT:
1201 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1202 break;
1203
1204 case PPEConstants.VAR_TYPE_COLOR:
1205 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1206 break;
1207 }
1208 }
1209 }
1210 }
1211
1212 void DbgPrnt(string text)
1213 {
1214 //Debug.Log(""+text);
1215 }
1216}
1217
1219// Base requester platforms //
1221
1223{
1224 override int GetCategoryMask()
1225 {
1226 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1227 }
1228}
1229
1231{
1232 override int GetCategoryMask()
1233 {
1234 return PPERequesterCategory.MENU_EFFECTS;
1235 }
1236}

◆ SendCurrentValueData()

void GetCategoryMask::SendCurrentValueData ( PPERequestParamDataBase data)
protected

Definition at line 754 of file PPERequestPlatformsBase.c.

756{
757 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
758 protected bool m_ValuesSent;
759 protected int m_IDX;
760
761 protected bool m_Valid = false;
762
763 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
764
766 {
767 m_Valid = PPERequesterBank.VerifyRequester(this);
768
770 m_ValuesSent = true;
771 m_IsRunning = false;
773 }
774
776 void SetRequesterUpdating(bool state)
777 {
778 if (!m_Valid)
779 {
780 Debug.Log("" + this + " not valid!");
781 return;
782 }
783
784 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
785
786 //TODO - separate into its own function?
787 if (state)
788 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
789 }
790
791 void Start(Param par = null)
792 {
793 OnStart(par);
794 m_IsRunning = true;
795 }
796
797 void Stop(Param par = null)
798 {
800 return;
801
802 OnStop(par);
803 m_IsRunning = false;
804 }
805
806 bool IsRequesterRunning()
807 {
808 return m_IsRunning;
809 }
810
812 void SetRequesterIDX(int idx)
813 {
814 m_IDX = idx;
815 }
816
818 int GetRequesterIDX()
819 {
820 return m_IDX;
821 }
822
824 int GetCategoryMask()
825 {
826 return PPERequesterCategory.NONE;
827 }
828
829 //SETTERS//
830 //vvvvvvv//
831 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
832 {
834 return;
835
837 data.SetPriorityLayer(priority_layer);
838 data.SetInteractionMask(operator);
839
840 data.m_BoolTarget = val;
841 data.m_BoolLast = data.m_BoolCurrent;
842
843 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
844 {
845 data.SetSettingDefaultValues(false);
846 data.SetDataActive(true);
847
849 }
850 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
851 }
852
853 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
854 {
855 //TODO - running check and cleanup rework (elsewhere!)
857 return;
858
860 data.m_BoolLast = data.m_BoolCurrent;
861 if (!data.IsSettingDefaultValues())
862 {
863 data.SetSettingDefaultValues(true);
864
866 }
867 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
868 }
869
870 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
871 {
873 return;
874
875 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
876 data.SetPriorityLayer(priority_layer);
877 data.SetInteractionMask(operator);
878
879 data.m_IntTarget = val;
880 data.m_IntLast = data.m_IntCurrent;
881 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
882 {
883 data.SetSettingDefaultValues(false);
884 data.SetDataActive(true);
885
887 }
888 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
889 }
890
891 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
892 {
893 //TODO - running check and cleanup rework (elsewhere!)
895 return;
896
897 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
898 data.m_IntLast = data.m_IntCurrent;
899 if (!data.IsSettingDefaultValues())
900 {
901 data.SetSettingDefaultValues(true);
902
904 }
905 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
906 }
907
908 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
909 {
911 return;
912
914 data.SetPriorityLayer(priority_layer);
915 data.SetInteractionMask(operator);
916
917 data.m_FloatFormerTarget = data.m_FloatTarget;
918 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
919 data.m_FloatLast = data.m_FloatCurrent;
920 data.m_FloatStart = data.m_FloatCurrent;
921 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
922 {
923 data.SetSettingDefaultValues(false);
924 data.SetDataActive(true);
925
927 }
928 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
929 }
930
931 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
932 {
933 //TODO - running check and cleanup rework (elsewhere!)
935 return;
936
938 data.m_FloatFormerTarget = data.m_FloatTarget;
939 data.m_FloatLast = data.m_FloatCurrent;
940 data.m_FloatStart = data.m_FloatCurrent;
941 if (!data.IsSettingDefaultValues())
942 {
943 data.SetSettingDefaultValues(true);
944
946 }
947 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
948 }
949
950 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
951 {
953 return;
954
955 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
956 data.SetPriorityLayer(priority_layer);
957 data.SetInteractionMask(operator);
958 data.m_ColorFormerTarget = data.m_ColorTarget;
959
960 data.m_ColorTarget.Copy(val);
961
962 data.m_ColorLast = data.m_ColorCurrent;
963 data.m_ColorStart = data.m_ColorCurrent;
964 //if (data.m_ColorTarget != data.m_ColorCurrent)
965 {
966 data.SetSettingDefaultValues(false);
967 data.SetDataActive(true);
968
970 }
971 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
972 }
973
974 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
975 {
976 //TODO - running check and cleanup rework (elsewhere!)
978 return;
979
980 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
981 data.m_ColorFormerTarget = data.m_ColorTarget;
982 data.m_ColorLast = data.m_ColorCurrent;
983 data.m_ColorStart = data.m_ColorCurrent;
984 if (!data.IsSettingDefaultValues())
985 {
986 data.SetSettingDefaultValues(true);
987
989 }
990 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
991 }
992
993 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
994 {
995 }
996
997 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
998 {
999 }*/
1000
1001 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1002 {
1003 }*/
1004
1006 protected void QueueValuesSend()
1007 {
1008 m_ValuesSent = false;
1009 //m_IsRunning = true;
1011 }
1012
1015 {
1018 {
1021 else
1022 {
1023 data = PrepareData(mat_id, param_idx, type);
1025 }
1026 }
1027 else
1028 {
1029 data = PrepareData(mat_id, param_idx, type);
1031 temp_map.Set(param_idx, data);
1033 }
1034
1035 if (!data)
1036 Error("GetRequestData | no data found in the structure");
1037
1038 data.m_Requester = this;
1039
1040 return data;
1041 }
1042
1043 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1044 {
1046 switch (type)
1047 {
1048 case PPEConstants.VAR_TYPE_BOOL:
1050 break;
1051
1052 case PPEConstants.VAR_TYPE_INT:
1053 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1054 break;
1055
1056 case PPEConstants.VAR_TYPE_FLOAT:
1058 break;
1059
1060 case PPEConstants.VAR_TYPE_COLOR:
1061 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1062 break;
1063 }
1064 return data;
1065 }
1066
1067 // unused?
1069 {
1071 }
1072
1073 protected void ClearRequesterData()
1074 {
1075 m_RequestDataStructure.Clear();
1076 }
1077
1079 {
1080 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1081 }
1082
1083 //EVENTS//
1084 //vvvvvv//
1085 void OnUpdate(float delta)
1086 {
1087 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1088
1089 if (!m_ValuesSent)
1090 {
1091 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1092 {
1093 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1094 {
1095 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1096 }
1097 }
1098 m_ValuesSent = true;
1099 }
1100 SetRequesterUpdating(false);
1101 }
1102
1103 protected void OnStart(Param par = null)
1104 {
1106 }
1107
1109 protected void OnStop(Param par = null)
1110 {
1111 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1114 }
1115
1117 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1118 {
1119 float ret = value;
1120 if (!relative) //if not already relative...
1121 {
1122 switch (var_type)
1123 {
1124 case PPEConstants.VAR_TYPE_FLOAT:
1126 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1127 ret = Math.Clamp(ret, 0.0, 1.0);
1128 break;
1129 }
1130 }
1131 //Print("RelativizeValue: " + ret);
1132
1133 return ret;
1134 }
1135
1137 protected void SetDefaultValuesAll()
1138 {
1139 //<material<param_id,data>>
1141
1142 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1143 {
1144 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1145 {
1146 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1147
1148 if (!req_data.IsDataActive())
1149 continue;
1150
1151 switch (req_data.GetVarType())
1152 {
1153 case PPEConstants.VAR_TYPE_BOOL:
1154 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1155 break;
1156
1157 case PPEConstants.VAR_TYPE_INT:
1158 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1159 break;
1160
1161 case PPEConstants.VAR_TYPE_FLOAT:
1162 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1163 break;
1164
1165 case PPEConstants.VAR_TYPE_COLOR:
1166 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1167 break;
1168 }
1169 }
1170 }
1171 }
1172
1173 void DbgPrnt(string text)
1174 {
1175 //Debug.Log(""+text);
1176 }
1177}
1178
1180// Base requester platforms //
1182
1184{
1185 override int GetCategoryMask()
1186 {
1187 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1188 }
1189}
1190
1192{
1193 override int GetCategoryMask()
1194 {
1195 return PPERequesterCategory.MENU_EFFECTS;
1196 }
1197}

◆ SetDefaultValuesAll()

void GetCategoryMask::SetDefaultValuesAll ( )
protected

Sets all requested values to default, ignoring them in further calculations.

Definition at line 813 of file PPERequestPlatformsBase.c.

815{
816 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
817 protected bool m_ValuesSent;
818 protected int m_IDX;
819
820 protected bool m_Valid = false;
821
822 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
823
825 {
826 m_Valid = PPERequesterBank.VerifyRequester(this);
827
829 m_ValuesSent = true;
830 m_IsRunning = false;
832 }
833
835 void SetRequesterUpdating(bool state)
836 {
837 if (!m_Valid)
838 {
839 Debug.Log("" + this + " not valid!");
840 return;
841 }
842
843 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
844
845 //TODO - separate into its own function?
846 if (state)
847 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
848 }
849
850 void Start(Param par = null)
851 {
852 OnStart(par);
853 m_IsRunning = true;
854 }
855
856 void Stop(Param par = null)
857 {
859 return;
860
861 OnStop(par);
862 m_IsRunning = false;
863 }
864
865 bool IsRequesterRunning()
866 {
867 return m_IsRunning;
868 }
869
871 void SetRequesterIDX(int idx)
872 {
873 m_IDX = idx;
874 }
875
877 int GetRequesterIDX()
878 {
879 return m_IDX;
880 }
881
883 int GetCategoryMask()
884 {
885 return PPERequesterCategory.NONE;
886 }
887
888 //SETTERS//
889 //vvvvvvv//
890 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
891 {
893 return;
894
896 data.SetPriorityLayer(priority_layer);
897 data.SetInteractionMask(operator);
898
899 data.m_BoolTarget = val;
900 data.m_BoolLast = data.m_BoolCurrent;
901
902 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
903 {
904 data.SetSettingDefaultValues(false);
905 data.SetDataActive(true);
906
908 }
909 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
910 }
911
912 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
913 {
914 //TODO - running check and cleanup rework (elsewhere!)
916 return;
917
919 data.m_BoolLast = data.m_BoolCurrent;
920 if (!data.IsSettingDefaultValues())
921 {
922 data.SetSettingDefaultValues(true);
923
925 }
926 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
927 }
928
929 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
930 {
932 return;
933
934 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
935 data.SetPriorityLayer(priority_layer);
936 data.SetInteractionMask(operator);
937
938 data.m_IntTarget = val;
939 data.m_IntLast = data.m_IntCurrent;
940 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
941 {
942 data.SetSettingDefaultValues(false);
943 data.SetDataActive(true);
944
946 }
947 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
948 }
949
950 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
951 {
952 //TODO - running check and cleanup rework (elsewhere!)
954 return;
955
956 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
957 data.m_IntLast = data.m_IntCurrent;
958 if (!data.IsSettingDefaultValues())
959 {
960 data.SetSettingDefaultValues(true);
961
963 }
964 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
965 }
966
967 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
968 {
970 return;
971
973 data.SetPriorityLayer(priority_layer);
974 data.SetInteractionMask(operator);
975
976 data.m_FloatFormerTarget = data.m_FloatTarget;
977 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
978 data.m_FloatLast = data.m_FloatCurrent;
979 data.m_FloatStart = data.m_FloatCurrent;
980 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
981 {
982 data.SetSettingDefaultValues(false);
983 data.SetDataActive(true);
984
986 }
987 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
988 }
989
990 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
991 {
992 //TODO - running check and cleanup rework (elsewhere!)
994 return;
995
997 data.m_FloatFormerTarget = data.m_FloatTarget;
998 data.m_FloatLast = data.m_FloatCurrent;
999 data.m_FloatStart = data.m_FloatCurrent;
1000 if (!data.IsSettingDefaultValues())
1001 {
1002 data.SetSettingDefaultValues(true);
1003
1005 }
1006 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1007 }
1008
1009 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1010 {
1012 return;
1013
1014 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1015 data.SetPriorityLayer(priority_layer);
1016 data.SetInteractionMask(operator);
1017 data.m_ColorFormerTarget = data.m_ColorTarget;
1018
1019 data.m_ColorTarget.Copy(val);
1020
1021 data.m_ColorLast = data.m_ColorCurrent;
1022 data.m_ColorStart = data.m_ColorCurrent;
1023 //if (data.m_ColorTarget != data.m_ColorCurrent)
1024 {
1025 data.SetSettingDefaultValues(false);
1026 data.SetDataActive(true);
1027
1029 }
1030 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1031 }
1032
1033 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
1034 {
1035 //TODO - running check and cleanup rework (elsewhere!)
1037 return;
1038
1039 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
1040 data.m_ColorFormerTarget = data.m_ColorTarget;
1041 data.m_ColorLast = data.m_ColorCurrent;
1042 data.m_ColorStart = data.m_ColorCurrent;
1043 if (!data.IsSettingDefaultValues())
1044 {
1045 data.SetSettingDefaultValues(true);
1046
1048 }
1049 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
1050 }
1051
1052 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
1053 {
1054 }
1055
1056 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1057 {
1058 }*/
1059
1060 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
1061 {
1062 }*/
1063
1065 protected void QueueValuesSend()
1066 {
1067 m_ValuesSent = false;
1068 //m_IsRunning = true;
1070 }
1071
1074 {
1077 {
1080 else
1081 {
1082 data = PrepareData(mat_id, param_idx, type);
1084 }
1085 }
1086 else
1087 {
1088 data = PrepareData(mat_id, param_idx, type);
1090 temp_map.Set(param_idx, data);
1092 }
1093
1094 if (!data)
1095 Error("GetRequestData | no data found in the structure");
1096
1097 data.m_Requester = this;
1098
1099 return data;
1100 }
1101
1102 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
1103 {
1105 switch (type)
1106 {
1107 case PPEConstants.VAR_TYPE_BOOL:
1109 break;
1110
1111 case PPEConstants.VAR_TYPE_INT:
1112 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
1113 break;
1114
1115 case PPEConstants.VAR_TYPE_FLOAT:
1117 break;
1118
1119 case PPEConstants.VAR_TYPE_COLOR:
1120 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
1121 break;
1122 }
1123 return data;
1124 }
1125
1126 // unused?
1128 {
1130 }
1131
1132 protected void ClearRequesterData()
1133 {
1134 m_RequestDataStructure.Clear();
1135 }
1136
1138 {
1139 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
1140 }
1141
1142 //EVENTS//
1143 //vvvvvv//
1144 void OnUpdate(float delta)
1145 {
1146 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
1147
1148 if (!m_ValuesSent)
1149 {
1150 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1151 {
1152 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1153 {
1154 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
1155 }
1156 }
1157 m_ValuesSent = true;
1158 }
1159 SetRequesterUpdating(false);
1160 }
1161
1162 protected void OnStart(Param par = null)
1163 {
1165 }
1166
1168 protected void OnStop(Param par = null)
1169 {
1170 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1173 }
1174
1176 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1177 {
1178 float ret = value;
1179 if (!relative) //if not already relative...
1180 {
1181 switch (var_type)
1182 {
1183 case PPEConstants.VAR_TYPE_FLOAT:
1185 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1186 ret = Math.Clamp(ret, 0.0, 1.0);
1187 break;
1188 }
1189 }
1190 //Print("RelativizeValue: " + ret);
1191
1192 return ret;
1193 }
1194
1196 protected void SetDefaultValuesAll()
1197 {
1198 //<material<param_id,data>>
1200
1201 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1202 {
1203 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1204 {
1205 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1206
1207 if (!req_data.IsDataActive())
1208 continue;
1209
1210 switch (req_data.GetVarType())
1211 {
1212 case PPEConstants.VAR_TYPE_BOOL:
1213 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1214 break;
1215
1216 case PPEConstants.VAR_TYPE_INT:
1217 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1218 break;
1219
1220 case PPEConstants.VAR_TYPE_FLOAT:
1221 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1222 break;
1223
1224 case PPEConstants.VAR_TYPE_COLOR:
1225 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1226 break;
1227 }
1228 }
1229 }
1230 }
1231
1232 void DbgPrnt(string text)
1233 {
1234 //Debug.Log(""+text);
1235 }
1236}
1237
1239// Base requester platforms //
1241
1243{
1244 override int GetCategoryMask()
1245 {
1246 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1247 }
1248}
1249
1251{
1252 override int GetCategoryMask()
1253 {
1254 return PPERequesterCategory.MENU_EFFECTS;
1255 }
1256}

◆ SetRequesterIDX()

void GetCategoryMask::SetRequesterIDX ( int idx)
protected

automatically assigned by PPERequesterBank

Definition at line 488 of file PPERequestPlatformsBase.c.

490{
491 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
492 protected bool m_ValuesSent;
493 protected int m_IDX;
494
495 protected bool m_Valid = false;
496
497 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
498
500 {
501 m_Valid = PPERequesterBank.VerifyRequester(this);
502
504 m_ValuesSent = true;
505 m_IsRunning = false;
507 }
508
510 void SetRequesterUpdating(bool state)
511 {
512 if (!m_Valid)
513 {
514 Debug.Log("" + this + " not valid!");
515 return;
516 }
517
518 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
519
520 //TODO - separate into its own function?
521 if (state)
522 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
523 }
524
525 void Start(Param par = null)
526 {
527 OnStart(par);
528 m_IsRunning = true;
529 }
530
531 void Stop(Param par = null)
532 {
534 return;
535
536 OnStop(par);
537 m_IsRunning = false;
538 }
539
540 bool IsRequesterRunning()
541 {
542 return m_IsRunning;
543 }
544
546 void SetRequesterIDX(int idx)
547 {
548 m_IDX = idx;
549 }
550
552 int GetRequesterIDX()
553 {
554 return m_IDX;
555 }
556
558 int GetCategoryMask()
559 {
560 return PPERequesterCategory.NONE;
561 }
562
563 //SETTERS//
564 //vvvvvvv//
565 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
566 {
568 return;
569
571 data.SetPriorityLayer(priority_layer);
572 data.SetInteractionMask(operator);
573
574 data.m_BoolTarget = val;
575 data.m_BoolLast = data.m_BoolCurrent;
576
577 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
578 {
579 data.SetSettingDefaultValues(false);
580 data.SetDataActive(true);
581
583 }
584 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
585 }
586
587 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
588 {
589 //TODO - running check and cleanup rework (elsewhere!)
591 return;
592
594 data.m_BoolLast = data.m_BoolCurrent;
595 if (!data.IsSettingDefaultValues())
596 {
597 data.SetSettingDefaultValues(true);
598
600 }
601 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
602 }
603
604 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
605 {
607 return;
608
609 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
610 data.SetPriorityLayer(priority_layer);
611 data.SetInteractionMask(operator);
612
613 data.m_IntTarget = val;
614 data.m_IntLast = data.m_IntCurrent;
615 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
616 {
617 data.SetSettingDefaultValues(false);
618 data.SetDataActive(true);
619
621 }
622 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
623 }
624
625 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
626 {
627 //TODO - running check and cleanup rework (elsewhere!)
629 return;
630
631 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
632 data.m_IntLast = data.m_IntCurrent;
633 if (!data.IsSettingDefaultValues())
634 {
635 data.SetSettingDefaultValues(true);
636
638 }
639 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
640 }
641
642 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
643 {
645 return;
646
648 data.SetPriorityLayer(priority_layer);
649 data.SetInteractionMask(operator);
650
651 data.m_FloatFormerTarget = data.m_FloatTarget;
652 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
653 data.m_FloatLast = data.m_FloatCurrent;
654 data.m_FloatStart = data.m_FloatCurrent;
655 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
656 {
657 data.SetSettingDefaultValues(false);
658 data.SetDataActive(true);
659
661 }
662 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
663 }
664
665 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
666 {
667 //TODO - running check and cleanup rework (elsewhere!)
669 return;
670
672 data.m_FloatFormerTarget = data.m_FloatTarget;
673 data.m_FloatLast = data.m_FloatCurrent;
674 data.m_FloatStart = data.m_FloatCurrent;
675 if (!data.IsSettingDefaultValues())
676 {
677 data.SetSettingDefaultValues(true);
678
680 }
681 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
682 }
683
684 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
685 {
687 return;
688
689 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
690 data.SetPriorityLayer(priority_layer);
691 data.SetInteractionMask(operator);
692 data.m_ColorFormerTarget = data.m_ColorTarget;
693
694 data.m_ColorTarget.Copy(val);
695
696 data.m_ColorLast = data.m_ColorCurrent;
697 data.m_ColorStart = data.m_ColorCurrent;
698 //if (data.m_ColorTarget != data.m_ColorCurrent)
699 {
700 data.SetSettingDefaultValues(false);
701 data.SetDataActive(true);
702
704 }
705 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
706 }
707
708 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
709 {
710 //TODO - running check and cleanup rework (elsewhere!)
712 return;
713
714 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
715 data.m_ColorFormerTarget = data.m_ColorTarget;
716 data.m_ColorLast = data.m_ColorCurrent;
717 data.m_ColorStart = data.m_ColorCurrent;
718 if (!data.IsSettingDefaultValues())
719 {
720 data.SetSettingDefaultValues(true);
721
723 }
724 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
725 }
726
727 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
728 {
729 }
730
731 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
732 {
733 }*/
734
735 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
736 {
737 }*/
738
740 protected void QueueValuesSend()
741 {
742 m_ValuesSent = false;
743 //m_IsRunning = true;
745 }
746
749 {
752 {
755 else
756 {
759 }
760 }
761 else
762 {
765 temp_map.Set(param_idx, data);
767 }
768
769 if (!data)
770 Error("GetRequestData | no data found in the structure");
771
772 data.m_Requester = this;
773
774 return data;
775 }
776
777 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
778 {
780 switch (type)
781 {
782 case PPEConstants.VAR_TYPE_BOOL:
784 break;
785
786 case PPEConstants.VAR_TYPE_INT:
787 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
788 break;
789
790 case PPEConstants.VAR_TYPE_FLOAT:
792 break;
793
794 case PPEConstants.VAR_TYPE_COLOR:
795 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
796 break;
797 }
798 return data;
799 }
800
801 // unused?
803 {
805 }
806
807 protected void ClearRequesterData()
808 {
810 }
811
813 {
814 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
815 }
816
817 //EVENTS//
818 //vvvvvv//
819 void OnUpdate(float delta)
820 {
821 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
822
823 if (!m_ValuesSent)
824 {
825 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
826 {
827 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
828 {
829 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
830 }
831 }
832 m_ValuesSent = true;
833 }
835 }
836
837 protected void OnStart(Param par = null)
838 {
840 }
841
843 protected void OnStop(Param par = null)
844 {
845 //DbgPrnt("PPEDebug | " + this + " | OnStop");
848 }
849
851 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
852 {
853 float ret = value;
854 if (!relative) //if not already relative...
855 {
856 switch (var_type)
857 {
858 case PPEConstants.VAR_TYPE_FLOAT:
860 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
861 ret = Math.Clamp(ret, 0.0, 1.0);
862 break;
863 }
864 }
865 //Print("RelativizeValue: " + ret);
866
867 return ret;
868 }
869
871 protected void SetDefaultValuesAll()
872 {
873 //<material<param_id,data>>
875
876 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
877 {
878 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
879 {
880 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
881
882 if (!req_data.IsDataActive())
883 continue;
884
885 switch (req_data.GetVarType())
886 {
887 case PPEConstants.VAR_TYPE_BOOL:
888 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
889 break;
890
891 case PPEConstants.VAR_TYPE_INT:
892 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
893 break;
894
895 case PPEConstants.VAR_TYPE_FLOAT:
896 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
897 break;
898
899 case PPEConstants.VAR_TYPE_COLOR:
900 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
901 break;
902 }
903 }
904 }
905 }
906
907 void DbgPrnt(string text)
908 {
909 //Debug.Log(""+text);
910 }
911}
912
914// Base requester platforms //
916
918{
919 override int GetCategoryMask()
920 {
921 return PPERequesterCategory.GAMEPLAY_EFFECTS;
922 }
923}
924
926{
927 override int GetCategoryMask()
928 {
929 return PPERequesterCategory.MENU_EFFECTS;
930 }
931}

◆ SetRequesterUpdating()

void GetCategoryMask::SetRequesterUpdating ( bool state)
protected

Has to be set for the requester to be handled.

Definition at line 452 of file PPERequestPlatformsBase.c.

454{
455 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
456 protected bool m_ValuesSent;
457 protected int m_IDX;
458
459 protected bool m_Valid = false;
460
461 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
462
464 {
465 m_Valid = PPERequesterBank.VerifyRequester(this);
466
468 m_ValuesSent = true;
469 m_IsRunning = false;
471 }
472
474 void SetRequesterUpdating(bool state)
475 {
476 if (!m_Valid)
477 {
478 Debug.Log("" + this + " not valid!");
479 return;
480 }
481
482 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
483
484 //TODO - separate into its own function?
485 if (state)
486 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
487 }
488
489 void Start(Param par = null)
490 {
491 OnStart(par);
492 m_IsRunning = true;
493 }
494
495 void Stop(Param par = null)
496 {
498 return;
499
500 OnStop(par);
501 m_IsRunning = false;
502 }
503
504 bool IsRequesterRunning()
505 {
506 return m_IsRunning;
507 }
508
510 void SetRequesterIDX(int idx)
511 {
512 m_IDX = idx;
513 }
514
516 int GetRequesterIDX()
517 {
518 return m_IDX;
519 }
520
522 int GetCategoryMask()
523 {
524 return PPERequesterCategory.NONE;
525 }
526
527 //SETTERS//
528 //vvvvvvv//
529 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
530 {
532 return;
533
535 data.SetPriorityLayer(priority_layer);
536 data.SetInteractionMask(operator);
537
538 data.m_BoolTarget = val;
539 data.m_BoolLast = data.m_BoolCurrent;
540
541 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
542 {
543 data.SetSettingDefaultValues(false);
544 data.SetDataActive(true);
545
547 }
548 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
549 }
550
551 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
552 {
553 //TODO - running check and cleanup rework (elsewhere!)
555 return;
556
558 data.m_BoolLast = data.m_BoolCurrent;
559 if (!data.IsSettingDefaultValues())
560 {
561 data.SetSettingDefaultValues(true);
562
564 }
565 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
566 }
567
568 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
569 {
571 return;
572
573 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
574 data.SetPriorityLayer(priority_layer);
575 data.SetInteractionMask(operator);
576
577 data.m_IntTarget = val;
578 data.m_IntLast = data.m_IntCurrent;
579 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
580 {
581 data.SetSettingDefaultValues(false);
582 data.SetDataActive(true);
583
585 }
586 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
587 }
588
589 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
590 {
591 //TODO - running check and cleanup rework (elsewhere!)
593 return;
594
595 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
596 data.m_IntLast = data.m_IntCurrent;
597 if (!data.IsSettingDefaultValues())
598 {
599 data.SetSettingDefaultValues(true);
600
602 }
603 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
604 }
605
606 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
607 {
609 return;
610
612 data.SetPriorityLayer(priority_layer);
613 data.SetInteractionMask(operator);
614
615 data.m_FloatFormerTarget = data.m_FloatTarget;
616 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
617 data.m_FloatLast = data.m_FloatCurrent;
618 data.m_FloatStart = data.m_FloatCurrent;
619 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
620 {
621 data.SetSettingDefaultValues(false);
622 data.SetDataActive(true);
623
625 }
626 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
627 }
628
629 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
630 {
631 //TODO - running check and cleanup rework (elsewhere!)
633 return;
634
636 data.m_FloatFormerTarget = data.m_FloatTarget;
637 data.m_FloatLast = data.m_FloatCurrent;
638 data.m_FloatStart = data.m_FloatCurrent;
639 if (!data.IsSettingDefaultValues())
640 {
641 data.SetSettingDefaultValues(true);
642
644 }
645 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
646 }
647
648 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
649 {
651 return;
652
653 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
654 data.SetPriorityLayer(priority_layer);
655 data.SetInteractionMask(operator);
656 data.m_ColorFormerTarget = data.m_ColorTarget;
657
658 data.m_ColorTarget.Copy(val);
659
660 data.m_ColorLast = data.m_ColorCurrent;
661 data.m_ColorStart = data.m_ColorCurrent;
662 //if (data.m_ColorTarget != data.m_ColorCurrent)
663 {
664 data.SetSettingDefaultValues(false);
665 data.SetDataActive(true);
666
668 }
669 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
670 }
671
672 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
673 {
674 //TODO - running check and cleanup rework (elsewhere!)
676 return;
677
678 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
679 data.m_ColorFormerTarget = data.m_ColorTarget;
680 data.m_ColorLast = data.m_ColorCurrent;
681 data.m_ColorStart = data.m_ColorCurrent;
682 if (!data.IsSettingDefaultValues())
683 {
684 data.SetSettingDefaultValues(true);
685
687 }
688 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
689 }
690
691 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
692 {
693 }
694
695 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
696 {
697 }*/
698
699 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
700 {
701 }*/
702
704 protected void QueueValuesSend()
705 {
706 m_ValuesSent = false;
707 //m_IsRunning = true;
709 }
710
713 {
716 {
719 else
720 {
723 }
724 }
725 else
726 {
729 temp_map.Set(param_idx, data);
731 }
732
733 if (!data)
734 Error("GetRequestData | no data found in the structure");
735
736 data.m_Requester = this;
737
738 return data;
739 }
740
741 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
742 {
744 switch (type)
745 {
746 case PPEConstants.VAR_TYPE_BOOL:
748 break;
749
750 case PPEConstants.VAR_TYPE_INT:
751 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
752 break;
753
754 case PPEConstants.VAR_TYPE_FLOAT:
756 break;
757
758 case PPEConstants.VAR_TYPE_COLOR:
759 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
760 break;
761 }
762 return data;
763 }
764
765 // unused?
767 {
769 }
770
771 protected void ClearRequesterData()
772 {
774 }
775
777 {
778 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
779 }
780
781 //EVENTS//
782 //vvvvvv//
783 void OnUpdate(float delta)
784 {
785 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
786
787 if (!m_ValuesSent)
788 {
789 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
790 {
791 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
792 {
793 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
794 }
795 }
796 m_ValuesSent = true;
797 }
799 }
800
801 protected void OnStart(Param par = null)
802 {
804 }
805
807 protected void OnStop(Param par = null)
808 {
809 //DbgPrnt("PPEDebug | " + this + " | OnStop");
812 }
813
815 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
816 {
817 float ret = value;
818 if (!relative) //if not already relative...
819 {
820 switch (var_type)
821 {
822 case PPEConstants.VAR_TYPE_FLOAT:
824 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
825 ret = Math.Clamp(ret, 0.0, 1.0);
826 break;
827 }
828 }
829 //Print("RelativizeValue: " + ret);
830
831 return ret;
832 }
833
835 protected void SetDefaultValuesAll()
836 {
837 //<material<param_id,data>>
839
840 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
841 {
842 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
843 {
844 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
845
846 if (!req_data.IsDataActive())
847 continue;
848
849 switch (req_data.GetVarType())
850 {
851 case PPEConstants.VAR_TYPE_BOOL:
852 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
853 break;
854
855 case PPEConstants.VAR_TYPE_INT:
856 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
857 break;
858
859 case PPEConstants.VAR_TYPE_FLOAT:
860 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
861 break;
862
863 case PPEConstants.VAR_TYPE_COLOR:
864 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
865 break;
866 }
867 }
868 }
869 }
870
871 void DbgPrnt(string text)
872 {
873 //Debug.Log(""+text);
874 }
875}
876
878// Base requester platforms //
880
882{
883 override int GetCategoryMask()
884 {
885 return PPERequesterCategory.GAMEPLAY_EFFECTS;
886 }
887}
888
890{
891 override int GetCategoryMask()
892 {
893 return PPERequesterCategory.MENU_EFFECTS;
894 }
895}

◆ SetTargetValueBool()

void GetCategoryMask::SetTargetValueBool ( int mat_id,
int param_idx,
bool val,
int priority_layer,
int operator = PPOperators.SET )
protected

Definition at line 507 of file PPERequestPlatformsBase.c.

509{
510 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
511 protected bool m_ValuesSent;
512 protected int m_IDX;
513
514 protected bool m_Valid = false;
515
516 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
517
519 {
520 m_Valid = PPERequesterBank.VerifyRequester(this);
521
523 m_ValuesSent = true;
524 m_IsRunning = false;
526 }
527
529 void SetRequesterUpdating(bool state)
530 {
531 if (!m_Valid)
532 {
533 Debug.Log("" + this + " not valid!");
534 return;
535 }
536
537 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
538
539 //TODO - separate into its own function?
540 if (state)
541 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
542 }
543
544 void Start(Param par = null)
545 {
546 OnStart(par);
547 m_IsRunning = true;
548 }
549
550 void Stop(Param par = null)
551 {
553 return;
554
555 OnStop(par);
556 m_IsRunning = false;
557 }
558
559 bool IsRequesterRunning()
560 {
561 return m_IsRunning;
562 }
563
565 void SetRequesterIDX(int idx)
566 {
567 m_IDX = idx;
568 }
569
571 int GetRequesterIDX()
572 {
573 return m_IDX;
574 }
575
577 int GetCategoryMask()
578 {
579 return PPERequesterCategory.NONE;
580 }
581
582 //SETTERS//
583 //vvvvvvv//
584 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
585 {
587 return;
588
590 data.SetPriorityLayer(priority_layer);
591 data.SetInteractionMask(operator);
592
593 data.m_BoolTarget = val;
594 data.m_BoolLast = data.m_BoolCurrent;
595
596 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
597 {
598 data.SetSettingDefaultValues(false);
599 data.SetDataActive(true);
600
602 }
603 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
604 }
605
606 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
607 {
608 //TODO - running check and cleanup rework (elsewhere!)
610 return;
611
613 data.m_BoolLast = data.m_BoolCurrent;
614 if (!data.IsSettingDefaultValues())
615 {
616 data.SetSettingDefaultValues(true);
617
619 }
620 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
621 }
622
623 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
624 {
626 return;
627
628 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
629 data.SetPriorityLayer(priority_layer);
630 data.SetInteractionMask(operator);
631
632 data.m_IntTarget = val;
633 data.m_IntLast = data.m_IntCurrent;
634 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
635 {
636 data.SetSettingDefaultValues(false);
637 data.SetDataActive(true);
638
640 }
641 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
642 }
643
644 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
645 {
646 //TODO - running check and cleanup rework (elsewhere!)
648 return;
649
650 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
651 data.m_IntLast = data.m_IntCurrent;
652 if (!data.IsSettingDefaultValues())
653 {
654 data.SetSettingDefaultValues(true);
655
657 }
658 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
659 }
660
661 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
662 {
664 return;
665
667 data.SetPriorityLayer(priority_layer);
668 data.SetInteractionMask(operator);
669
670 data.m_FloatFormerTarget = data.m_FloatTarget;
671 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
672 data.m_FloatLast = data.m_FloatCurrent;
673 data.m_FloatStart = data.m_FloatCurrent;
674 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
675 {
676 data.SetSettingDefaultValues(false);
677 data.SetDataActive(true);
678
680 }
681 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
682 }
683
684 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
685 {
686 //TODO - running check and cleanup rework (elsewhere!)
688 return;
689
691 data.m_FloatFormerTarget = data.m_FloatTarget;
692 data.m_FloatLast = data.m_FloatCurrent;
693 data.m_FloatStart = data.m_FloatCurrent;
694 if (!data.IsSettingDefaultValues())
695 {
696 data.SetSettingDefaultValues(true);
697
699 }
700 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
701 }
702
703 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
704 {
706 return;
707
708 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
709 data.SetPriorityLayer(priority_layer);
710 data.SetInteractionMask(operator);
711 data.m_ColorFormerTarget = data.m_ColorTarget;
712
713 data.m_ColorTarget.Copy(val);
714
715 data.m_ColorLast = data.m_ColorCurrent;
716 data.m_ColorStart = data.m_ColorCurrent;
717 //if (data.m_ColorTarget != data.m_ColorCurrent)
718 {
719 data.SetSettingDefaultValues(false);
720 data.SetDataActive(true);
721
723 }
724 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
725 }
726
727 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
728 {
729 //TODO - running check and cleanup rework (elsewhere!)
731 return;
732
733 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
734 data.m_ColorFormerTarget = data.m_ColorTarget;
735 data.m_ColorLast = data.m_ColorCurrent;
736 data.m_ColorStart = data.m_ColorCurrent;
737 if (!data.IsSettingDefaultValues())
738 {
739 data.SetSettingDefaultValues(true);
740
742 }
743 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
744 }
745
746 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
747 {
748 }
749
750 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
751 {
752 }*/
753
754 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
755 {
756 }*/
757
759 protected void QueueValuesSend()
760 {
761 m_ValuesSent = false;
762 //m_IsRunning = true;
764 }
765
768 {
771 {
774 else
775 {
778 }
779 }
780 else
781 {
784 temp_map.Set(param_idx, data);
786 }
787
788 if (!data)
789 Error("GetRequestData | no data found in the structure");
790
791 data.m_Requester = this;
792
793 return data;
794 }
795
796 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
797 {
799 switch (type)
800 {
801 case PPEConstants.VAR_TYPE_BOOL:
803 break;
804
805 case PPEConstants.VAR_TYPE_INT:
806 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
807 break;
808
809 case PPEConstants.VAR_TYPE_FLOAT:
811 break;
812
813 case PPEConstants.VAR_TYPE_COLOR:
814 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
815 break;
816 }
817 return data;
818 }
819
820 // unused?
822 {
824 }
825
826 protected void ClearRequesterData()
827 {
829 }
830
832 {
833 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
834 }
835
836 //EVENTS//
837 //vvvvvv//
838 void OnUpdate(float delta)
839 {
840 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
841
842 if (!m_ValuesSent)
843 {
844 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
845 {
846 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
847 {
848 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
849 }
850 }
851 m_ValuesSent = true;
852 }
854 }
855
856 protected void OnStart(Param par = null)
857 {
859 }
860
862 protected void OnStop(Param par = null)
863 {
864 //DbgPrnt("PPEDebug | " + this + " | OnStop");
867 }
868
870 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
871 {
872 float ret = value;
873 if (!relative) //if not already relative...
874 {
875 switch (var_type)
876 {
877 case PPEConstants.VAR_TYPE_FLOAT:
879 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
880 ret = Math.Clamp(ret, 0.0, 1.0);
881 break;
882 }
883 }
884 //Print("RelativizeValue: " + ret);
885
886 return ret;
887 }
888
890 protected void SetDefaultValuesAll()
891 {
892 //<material<param_id,data>>
894
895 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
896 {
897 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
898 {
899 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
900
901 if (!req_data.IsDataActive())
902 continue;
903
904 switch (req_data.GetVarType())
905 {
906 case PPEConstants.VAR_TYPE_BOOL:
907 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
908 break;
909
910 case PPEConstants.VAR_TYPE_INT:
911 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
912 break;
913
914 case PPEConstants.VAR_TYPE_FLOAT:
915 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
916 break;
917
918 case PPEConstants.VAR_TYPE_COLOR:
919 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
920 break;
921 }
922 }
923 }
924 }
925
926 void DbgPrnt(string text)
927 {
928 //Debug.Log(""+text);
929 }
930}
931
933// Base requester platforms //
935
937{
938 override int GetCategoryMask()
939 {
940 return PPERequesterCategory.GAMEPLAY_EFFECTS;
941 }
942}
943
945{
946 override int GetCategoryMask()
947 {
948 return PPERequesterCategory.MENU_EFFECTS;
949 }
950}

Referenced by PPERequester_GameplayBase::SetValuesIronsights().

◆ SetTargetValueBoolDefault()

void GetCategoryMask::SetTargetValueBoolDefault ( int mat_id,
int param_idx )
protected

Definition at line 529 of file PPERequestPlatformsBase.c.

531{
532 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
533 protected bool m_ValuesSent;
534 protected int m_IDX;
535
536 protected bool m_Valid = false;
537
538 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
539
541 {
542 m_Valid = PPERequesterBank.VerifyRequester(this);
543
545 m_ValuesSent = true;
546 m_IsRunning = false;
548 }
549
551 void SetRequesterUpdating(bool state)
552 {
553 if (!m_Valid)
554 {
555 Debug.Log("" + this + " not valid!");
556 return;
557 }
558
559 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
560
561 //TODO - separate into its own function?
562 if (state)
563 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
564 }
565
566 void Start(Param par = null)
567 {
568 OnStart(par);
569 m_IsRunning = true;
570 }
571
572 void Stop(Param par = null)
573 {
575 return;
576
577 OnStop(par);
578 m_IsRunning = false;
579 }
580
581 bool IsRequesterRunning()
582 {
583 return m_IsRunning;
584 }
585
587 void SetRequesterIDX(int idx)
588 {
589 m_IDX = idx;
590 }
591
593 int GetRequesterIDX()
594 {
595 return m_IDX;
596 }
597
599 int GetCategoryMask()
600 {
601 return PPERequesterCategory.NONE;
602 }
603
604 //SETTERS//
605 //vvvvvvv//
606 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
607 {
609 return;
610
612 data.SetPriorityLayer(priority_layer);
613 data.SetInteractionMask(operator);
614
615 data.m_BoolTarget = val;
616 data.m_BoolLast = data.m_BoolCurrent;
617
618 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
619 {
620 data.SetSettingDefaultValues(false);
621 data.SetDataActive(true);
622
624 }
625 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
626 }
627
628 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
629 {
630 //TODO - running check and cleanup rework (elsewhere!)
632 return;
633
635 data.m_BoolLast = data.m_BoolCurrent;
636 if (!data.IsSettingDefaultValues())
637 {
638 data.SetSettingDefaultValues(true);
639
641 }
642 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
643 }
644
645 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
646 {
648 return;
649
650 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
651 data.SetPriorityLayer(priority_layer);
652 data.SetInteractionMask(operator);
653
654 data.m_IntTarget = val;
655 data.m_IntLast = data.m_IntCurrent;
656 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
657 {
658 data.SetSettingDefaultValues(false);
659 data.SetDataActive(true);
660
662 }
663 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
664 }
665
666 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
667 {
668 //TODO - running check and cleanup rework (elsewhere!)
670 return;
671
672 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
673 data.m_IntLast = data.m_IntCurrent;
674 if (!data.IsSettingDefaultValues())
675 {
676 data.SetSettingDefaultValues(true);
677
679 }
680 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
681 }
682
683 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
684 {
686 return;
687
689 data.SetPriorityLayer(priority_layer);
690 data.SetInteractionMask(operator);
691
692 data.m_FloatFormerTarget = data.m_FloatTarget;
693 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
694 data.m_FloatLast = data.m_FloatCurrent;
695 data.m_FloatStart = data.m_FloatCurrent;
696 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
697 {
698 data.SetSettingDefaultValues(false);
699 data.SetDataActive(true);
700
702 }
703 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
704 }
705
706 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
707 {
708 //TODO - running check and cleanup rework (elsewhere!)
710 return;
711
713 data.m_FloatFormerTarget = data.m_FloatTarget;
714 data.m_FloatLast = data.m_FloatCurrent;
715 data.m_FloatStart = data.m_FloatCurrent;
716 if (!data.IsSettingDefaultValues())
717 {
718 data.SetSettingDefaultValues(true);
719
721 }
722 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
723 }
724
725 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
726 {
728 return;
729
730 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
731 data.SetPriorityLayer(priority_layer);
732 data.SetInteractionMask(operator);
733 data.m_ColorFormerTarget = data.m_ColorTarget;
734
735 data.m_ColorTarget.Copy(val);
736
737 data.m_ColorLast = data.m_ColorCurrent;
738 data.m_ColorStart = data.m_ColorCurrent;
739 //if (data.m_ColorTarget != data.m_ColorCurrent)
740 {
741 data.SetSettingDefaultValues(false);
742 data.SetDataActive(true);
743
745 }
746 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
747 }
748
749 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
750 {
751 //TODO - running check and cleanup rework (elsewhere!)
753 return;
754
755 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
756 data.m_ColorFormerTarget = data.m_ColorTarget;
757 data.m_ColorLast = data.m_ColorCurrent;
758 data.m_ColorStart = data.m_ColorCurrent;
759 if (!data.IsSettingDefaultValues())
760 {
761 data.SetSettingDefaultValues(true);
762
764 }
765 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
766 }
767
768 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
769 {
770 }
771
772 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
773 {
774 }*/
775
776 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
777 {
778 }*/
779
781 protected void QueueValuesSend()
782 {
783 m_ValuesSent = false;
784 //m_IsRunning = true;
786 }
787
790 {
793 {
796 else
797 {
800 }
801 }
802 else
803 {
806 temp_map.Set(param_idx, data);
808 }
809
810 if (!data)
811 Error("GetRequestData | no data found in the structure");
812
813 data.m_Requester = this;
814
815 return data;
816 }
817
818 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
819 {
821 switch (type)
822 {
823 case PPEConstants.VAR_TYPE_BOOL:
825 break;
826
827 case PPEConstants.VAR_TYPE_INT:
828 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
829 break;
830
831 case PPEConstants.VAR_TYPE_FLOAT:
833 break;
834
835 case PPEConstants.VAR_TYPE_COLOR:
836 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
837 break;
838 }
839 return data;
840 }
841
842 // unused?
844 {
846 }
847
848 protected void ClearRequesterData()
849 {
851 }
852
854 {
855 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
856 }
857
858 //EVENTS//
859 //vvvvvv//
860 void OnUpdate(float delta)
861 {
862 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
863
864 if (!m_ValuesSent)
865 {
866 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
867 {
868 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
869 {
870 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
871 }
872 }
873 m_ValuesSent = true;
874 }
876 }
877
878 protected void OnStart(Param par = null)
879 {
881 }
882
884 protected void OnStop(Param par = null)
885 {
886 //DbgPrnt("PPEDebug | " + this + " | OnStop");
889 }
890
892 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
893 {
894 float ret = value;
895 if (!relative) //if not already relative...
896 {
897 switch (var_type)
898 {
899 case PPEConstants.VAR_TYPE_FLOAT:
901 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
902 ret = Math.Clamp(ret, 0.0, 1.0);
903 break;
904 }
905 }
906 //Print("RelativizeValue: " + ret);
907
908 return ret;
909 }
910
912 protected void SetDefaultValuesAll()
913 {
914 //<material<param_id,data>>
916
917 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
918 {
919 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
920 {
921 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
922
923 if (!req_data.IsDataActive())
924 continue;
925
926 switch (req_data.GetVarType())
927 {
928 case PPEConstants.VAR_TYPE_BOOL:
929 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
930 break;
931
932 case PPEConstants.VAR_TYPE_INT:
933 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
934 break;
935
936 case PPEConstants.VAR_TYPE_FLOAT:
937 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
938 break;
939
940 case PPEConstants.VAR_TYPE_COLOR:
941 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
942 break;
943 }
944 }
945 }
946 }
947
948 void DbgPrnt(string text)
949 {
950 //Debug.Log(""+text);
951 }
952}
953
955// Base requester platforms //
957
959{
960 override int GetCategoryMask()
961 {
962 return PPERequesterCategory.GAMEPLAY_EFFECTS;
963 }
964}
965
967{
968 override int GetCategoryMask()
969 {
970 return PPERequesterCategory.MENU_EFFECTS;
971 }
972}

Referenced by PPERequester_GameplayBase::SetValuesOptics().

◆ SetTargetValueColor()

void GetCategoryMask::SetTargetValueColor ( int mat_id,
int param_idx,
ref array< float > val,
int priority_layer,
int operator = PPOperators.ADD_RELATIVE )
protected

Definition at line 626 of file PPERequestPlatformsBase.c.

628{
629 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
630 protected bool m_ValuesSent;
631 protected int m_IDX;
632
633 protected bool m_Valid = false;
634
635 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
636
638 {
639 m_Valid = PPERequesterBank.VerifyRequester(this);
640
642 m_ValuesSent = true;
643 m_IsRunning = false;
645 }
646
648 void SetRequesterUpdating(bool state)
649 {
650 if (!m_Valid)
651 {
652 Debug.Log("" + this + " not valid!");
653 return;
654 }
655
656 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
657
658 //TODO - separate into its own function?
659 if (state)
660 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
661 }
662
663 void Start(Param par = null)
664 {
665 OnStart(par);
666 m_IsRunning = true;
667 }
668
669 void Stop(Param par = null)
670 {
672 return;
673
674 OnStop(par);
675 m_IsRunning = false;
676 }
677
678 bool IsRequesterRunning()
679 {
680 return m_IsRunning;
681 }
682
684 void SetRequesterIDX(int idx)
685 {
686 m_IDX = idx;
687 }
688
690 int GetRequesterIDX()
691 {
692 return m_IDX;
693 }
694
696 int GetCategoryMask()
697 {
698 return PPERequesterCategory.NONE;
699 }
700
701 //SETTERS//
702 //vvvvvvv//
703 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
704 {
706 return;
707
709 data.SetPriorityLayer(priority_layer);
710 data.SetInteractionMask(operator);
711
712 data.m_BoolTarget = val;
713 data.m_BoolLast = data.m_BoolCurrent;
714
715 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
716 {
717 data.SetSettingDefaultValues(false);
718 data.SetDataActive(true);
719
721 }
722 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
723 }
724
725 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
726 {
727 //TODO - running check and cleanup rework (elsewhere!)
729 return;
730
732 data.m_BoolLast = data.m_BoolCurrent;
733 if (!data.IsSettingDefaultValues())
734 {
735 data.SetSettingDefaultValues(true);
736
738 }
739 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
740 }
741
742 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
743 {
745 return;
746
747 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
748 data.SetPriorityLayer(priority_layer);
749 data.SetInteractionMask(operator);
750
751 data.m_IntTarget = val;
752 data.m_IntLast = data.m_IntCurrent;
753 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
754 {
755 data.SetSettingDefaultValues(false);
756 data.SetDataActive(true);
757
759 }
760 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
761 }
762
763 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
764 {
765 //TODO - running check and cleanup rework (elsewhere!)
767 return;
768
769 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
770 data.m_IntLast = data.m_IntCurrent;
771 if (!data.IsSettingDefaultValues())
772 {
773 data.SetSettingDefaultValues(true);
774
776 }
777 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
778 }
779
780 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
781 {
783 return;
784
786 data.SetPriorityLayer(priority_layer);
787 data.SetInteractionMask(operator);
788
789 data.m_FloatFormerTarget = data.m_FloatTarget;
790 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
791 data.m_FloatLast = data.m_FloatCurrent;
792 data.m_FloatStart = data.m_FloatCurrent;
793 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
794 {
795 data.SetSettingDefaultValues(false);
796 data.SetDataActive(true);
797
799 }
800 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
801 }
802
803 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
804 {
805 //TODO - running check and cleanup rework (elsewhere!)
807 return;
808
810 data.m_FloatFormerTarget = data.m_FloatTarget;
811 data.m_FloatLast = data.m_FloatCurrent;
812 data.m_FloatStart = data.m_FloatCurrent;
813 if (!data.IsSettingDefaultValues())
814 {
815 data.SetSettingDefaultValues(true);
816
818 }
819 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
820 }
821
822 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
823 {
825 return;
826
827 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
828 data.SetPriorityLayer(priority_layer);
829 data.SetInteractionMask(operator);
830 data.m_ColorFormerTarget = data.m_ColorTarget;
831
832 data.m_ColorTarget.Copy(val);
833
834 data.m_ColorLast = data.m_ColorCurrent;
835 data.m_ColorStart = data.m_ColorCurrent;
836 //if (data.m_ColorTarget != data.m_ColorCurrent)
837 {
838 data.SetSettingDefaultValues(false);
839 data.SetDataActive(true);
840
842 }
843 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
844 }
845
846 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
847 {
848 //TODO - running check and cleanup rework (elsewhere!)
850 return;
851
852 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
853 data.m_ColorFormerTarget = data.m_ColorTarget;
854 data.m_ColorLast = data.m_ColorCurrent;
855 data.m_ColorStart = data.m_ColorCurrent;
856 if (!data.IsSettingDefaultValues())
857 {
858 data.SetSettingDefaultValues(true);
859
861 }
862 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
863 }
864
865 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
866 {
867 }
868
869 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
870 {
871 }*/
872
873 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
874 {
875 }*/
876
878 protected void QueueValuesSend()
879 {
880 m_ValuesSent = false;
881 //m_IsRunning = true;
883 }
884
887 {
890 {
893 else
894 {
897 }
898 }
899 else
900 {
903 temp_map.Set(param_idx, data);
905 }
906
907 if (!data)
908 Error("GetRequestData | no data found in the structure");
909
910 data.m_Requester = this;
911
912 return data;
913 }
914
915 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
916 {
918 switch (type)
919 {
920 case PPEConstants.VAR_TYPE_BOOL:
922 break;
923
924 case PPEConstants.VAR_TYPE_INT:
925 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
926 break;
927
928 case PPEConstants.VAR_TYPE_FLOAT:
930 break;
931
932 case PPEConstants.VAR_TYPE_COLOR:
933 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
934 break;
935 }
936 return data;
937 }
938
939 // unused?
941 {
943 }
944
945 protected void ClearRequesterData()
946 {
948 }
949
951 {
952 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
953 }
954
955 //EVENTS//
956 //vvvvvv//
957 void OnUpdate(float delta)
958 {
959 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
960
961 if (!m_ValuesSent)
962 {
963 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
964 {
965 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
966 {
967 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
968 }
969 }
970 m_ValuesSent = true;
971 }
973 }
974
975 protected void OnStart(Param par = null)
976 {
978 }
979
981 protected void OnStop(Param par = null)
982 {
983 //DbgPrnt("PPEDebug | " + this + " | OnStop");
986 }
987
989 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
990 {
991 float ret = value;
992 if (!relative) //if not already relative...
993 {
994 switch (var_type)
995 {
996 case PPEConstants.VAR_TYPE_FLOAT:
998 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
999 ret = Math.Clamp(ret, 0.0, 1.0);
1000 break;
1001 }
1002 }
1003 //Print("RelativizeValue: " + ret);
1004
1005 return ret;
1006 }
1007
1009 protected void SetDefaultValuesAll()
1010 {
1011 //<material<param_id,data>>
1013
1014 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1015 {
1016 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1017 {
1018 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1019
1020 if (!req_data.IsDataActive())
1021 continue;
1022
1023 switch (req_data.GetVarType())
1024 {
1025 case PPEConstants.VAR_TYPE_BOOL:
1026 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1027 break;
1028
1029 case PPEConstants.VAR_TYPE_INT:
1030 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1031 break;
1032
1033 case PPEConstants.VAR_TYPE_FLOAT:
1034 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1035 break;
1036
1037 case PPEConstants.VAR_TYPE_COLOR:
1038 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1039 break;
1040 }
1041 }
1042 }
1043 }
1044
1045 void DbgPrnt(string text)
1046 {
1047 //Debug.Log(""+text);
1048 }
1049}
1050
1052// Base requester platforms //
1054
1056{
1057 override int GetCategoryMask()
1058 {
1059 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1060 }
1061}
1062
1064{
1065 override int GetCategoryMask()
1066 {
1067 return PPERequesterCategory.MENU_EFFECTS;
1068 }
1069}

Referenced by PPERequester_GameplayBase::OnStart(), PPERequester_GameplayBase::OnUpdate(), PPERequester_GameplayBase::SetFlashbangIntensity(), PPERequester_GameplayBase::SetHitIntensity(), PPERequester_GameplayBase::SetNVMode(), and PPERequester_MenuBase::SetVignetteIntensity().

◆ SetTargetValueColorDefault()

void GetCategoryMask::SetTargetValueColorDefault ( int mat_id,
int param_idx )
protected

Definition at line 650 of file PPERequestPlatformsBase.c.

652{
653 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
654 protected bool m_ValuesSent;
655 protected int m_IDX;
656
657 protected bool m_Valid = false;
658
659 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
660
662 {
663 m_Valid = PPERequesterBank.VerifyRequester(this);
664
666 m_ValuesSent = true;
667 m_IsRunning = false;
669 }
670
672 void SetRequesterUpdating(bool state)
673 {
674 if (!m_Valid)
675 {
676 Debug.Log("" + this + " not valid!");
677 return;
678 }
679
680 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
681
682 //TODO - separate into its own function?
683 if (state)
684 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
685 }
686
687 void Start(Param par = null)
688 {
689 OnStart(par);
690 m_IsRunning = true;
691 }
692
693 void Stop(Param par = null)
694 {
696 return;
697
698 OnStop(par);
699 m_IsRunning = false;
700 }
701
702 bool IsRequesterRunning()
703 {
704 return m_IsRunning;
705 }
706
708 void SetRequesterIDX(int idx)
709 {
710 m_IDX = idx;
711 }
712
714 int GetRequesterIDX()
715 {
716 return m_IDX;
717 }
718
720 int GetCategoryMask()
721 {
722 return PPERequesterCategory.NONE;
723 }
724
725 //SETTERS//
726 //vvvvvvv//
727 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
728 {
730 return;
731
733 data.SetPriorityLayer(priority_layer);
734 data.SetInteractionMask(operator);
735
736 data.m_BoolTarget = val;
737 data.m_BoolLast = data.m_BoolCurrent;
738
739 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
740 {
741 data.SetSettingDefaultValues(false);
742 data.SetDataActive(true);
743
745 }
746 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
747 }
748
749 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
750 {
751 //TODO - running check and cleanup rework (elsewhere!)
753 return;
754
756 data.m_BoolLast = data.m_BoolCurrent;
757 if (!data.IsSettingDefaultValues())
758 {
759 data.SetSettingDefaultValues(true);
760
762 }
763 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
764 }
765
766 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
767 {
769 return;
770
771 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
772 data.SetPriorityLayer(priority_layer);
773 data.SetInteractionMask(operator);
774
775 data.m_IntTarget = val;
776 data.m_IntLast = data.m_IntCurrent;
777 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
778 {
779 data.SetSettingDefaultValues(false);
780 data.SetDataActive(true);
781
783 }
784 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
785 }
786
787 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
788 {
789 //TODO - running check and cleanup rework (elsewhere!)
791 return;
792
793 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
794 data.m_IntLast = data.m_IntCurrent;
795 if (!data.IsSettingDefaultValues())
796 {
797 data.SetSettingDefaultValues(true);
798
800 }
801 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
802 }
803
804 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
805 {
807 return;
808
810 data.SetPriorityLayer(priority_layer);
811 data.SetInteractionMask(operator);
812
813 data.m_FloatFormerTarget = data.m_FloatTarget;
814 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
815 data.m_FloatLast = data.m_FloatCurrent;
816 data.m_FloatStart = data.m_FloatCurrent;
817 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
818 {
819 data.SetSettingDefaultValues(false);
820 data.SetDataActive(true);
821
823 }
824 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
825 }
826
827 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
828 {
829 //TODO - running check and cleanup rework (elsewhere!)
831 return;
832
834 data.m_FloatFormerTarget = data.m_FloatTarget;
835 data.m_FloatLast = data.m_FloatCurrent;
836 data.m_FloatStart = data.m_FloatCurrent;
837 if (!data.IsSettingDefaultValues())
838 {
839 data.SetSettingDefaultValues(true);
840
842 }
843 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
844 }
845
846 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
847 {
849 return;
850
851 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
852 data.SetPriorityLayer(priority_layer);
853 data.SetInteractionMask(operator);
854 data.m_ColorFormerTarget = data.m_ColorTarget;
855
856 data.m_ColorTarget.Copy(val);
857
858 data.m_ColorLast = data.m_ColorCurrent;
859 data.m_ColorStart = data.m_ColorCurrent;
860 //if (data.m_ColorTarget != data.m_ColorCurrent)
861 {
862 data.SetSettingDefaultValues(false);
863 data.SetDataActive(true);
864
866 }
867 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
868 }
869
870 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
871 {
872 //TODO - running check and cleanup rework (elsewhere!)
874 return;
875
876 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
877 data.m_ColorFormerTarget = data.m_ColorTarget;
878 data.m_ColorLast = data.m_ColorCurrent;
879 data.m_ColorStart = data.m_ColorCurrent;
880 if (!data.IsSettingDefaultValues())
881 {
882 data.SetSettingDefaultValues(true);
883
885 }
886 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
887 }
888
889 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
890 {
891 }
892
893 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
894 {
895 }*/
896
897 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
898 {
899 }*/
900
902 protected void QueueValuesSend()
903 {
904 m_ValuesSent = false;
905 //m_IsRunning = true;
907 }
908
911 {
914 {
917 else
918 {
921 }
922 }
923 else
924 {
927 temp_map.Set(param_idx, data);
929 }
930
931 if (!data)
932 Error("GetRequestData | no data found in the structure");
933
934 data.m_Requester = this;
935
936 return data;
937 }
938
939 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
940 {
942 switch (type)
943 {
944 case PPEConstants.VAR_TYPE_BOOL:
946 break;
947
948 case PPEConstants.VAR_TYPE_INT:
949 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
950 break;
951
952 case PPEConstants.VAR_TYPE_FLOAT:
954 break;
955
956 case PPEConstants.VAR_TYPE_COLOR:
957 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
958 break;
959 }
960 return data;
961 }
962
963 // unused?
965 {
967 }
968
969 protected void ClearRequesterData()
970 {
972 }
973
975 {
976 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
977 }
978
979 //EVENTS//
980 //vvvvvv//
981 void OnUpdate(float delta)
982 {
983 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
984
985 if (!m_ValuesSent)
986 {
987 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
988 {
989 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
990 {
991 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
992 }
993 }
994 m_ValuesSent = true;
995 }
997 }
998
999 protected void OnStart(Param par = null)
1000 {
1002 }
1003
1005 protected void OnStop(Param par = null)
1006 {
1007 //DbgPrnt("PPEDebug | " + this + " | OnStop");
1010 }
1011
1013 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
1014 {
1015 float ret = value;
1016 if (!relative) //if not already relative...
1017 {
1018 switch (var_type)
1019 {
1020 case PPEConstants.VAR_TYPE_FLOAT:
1022 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
1023 ret = Math.Clamp(ret, 0.0, 1.0);
1024 break;
1025 }
1026 }
1027 //Print("RelativizeValue: " + ret);
1028
1029 return ret;
1030 }
1031
1033 protected void SetDefaultValuesAll()
1034 {
1035 //<material<param_id,data>>
1037
1038 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
1039 {
1040 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
1041 {
1042 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1043
1044 if (!req_data.IsDataActive())
1045 continue;
1046
1047 switch (req_data.GetVarType())
1048 {
1049 case PPEConstants.VAR_TYPE_BOOL:
1050 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1051 break;
1052
1053 case PPEConstants.VAR_TYPE_INT:
1054 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1055 break;
1056
1057 case PPEConstants.VAR_TYPE_FLOAT:
1058 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1059 break;
1060
1061 case PPEConstants.VAR_TYPE_COLOR:
1062 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1063 break;
1064 }
1065 }
1066 }
1067 }
1068
1069 void DbgPrnt(string text)
1070 {
1071 //Debug.Log(""+text);
1072 }
1073}
1074
1076// Base requester platforms //
1078
1080{
1081 override int GetCategoryMask()
1082 {
1083 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1084 }
1085}
1086
1088{
1089 override int GetCategoryMask()
1090 {
1091 return PPERequesterCategory.MENU_EFFECTS;
1092 }
1093}

◆ SetTargetValueFloat()

void GetCategoryMask::SetTargetValueFloat ( int mat_id,
int param_idx,
bool relative,
float val,
int priority_layer,
int operator = PPOperators.ADD_RELATIVE )
protected

Definition at line 584 of file PPERequestPlatformsBase.c.

586{
587 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
588 protected bool m_ValuesSent;
589 protected int m_IDX;
590
591 protected bool m_Valid = false;
592
593 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
594
596 {
597 m_Valid = PPERequesterBank.VerifyRequester(this);
598
600 m_ValuesSent = true;
601 m_IsRunning = false;
603 }
604
606 void SetRequesterUpdating(bool state)
607 {
608 if (!m_Valid)
609 {
610 Debug.Log("" + this + " not valid!");
611 return;
612 }
613
614 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
615
616 //TODO - separate into its own function?
617 if (state)
618 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
619 }
620
621 void Start(Param par = null)
622 {
623 OnStart(par);
624 m_IsRunning = true;
625 }
626
627 void Stop(Param par = null)
628 {
630 return;
631
632 OnStop(par);
633 m_IsRunning = false;
634 }
635
636 bool IsRequesterRunning()
637 {
638 return m_IsRunning;
639 }
640
642 void SetRequesterIDX(int idx)
643 {
644 m_IDX = idx;
645 }
646
648 int GetRequesterIDX()
649 {
650 return m_IDX;
651 }
652
654 int GetCategoryMask()
655 {
656 return PPERequesterCategory.NONE;
657 }
658
659 //SETTERS//
660 //vvvvvvv//
661 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
662 {
664 return;
665
667 data.SetPriorityLayer(priority_layer);
668 data.SetInteractionMask(operator);
669
670 data.m_BoolTarget = val;
671 data.m_BoolLast = data.m_BoolCurrent;
672
673 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
674 {
675 data.SetSettingDefaultValues(false);
676 data.SetDataActive(true);
677
679 }
680 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
681 }
682
683 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
684 {
685 //TODO - running check and cleanup rework (elsewhere!)
687 return;
688
690 data.m_BoolLast = data.m_BoolCurrent;
691 if (!data.IsSettingDefaultValues())
692 {
693 data.SetSettingDefaultValues(true);
694
696 }
697 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
698 }
699
700 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
701 {
703 return;
704
705 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
706 data.SetPriorityLayer(priority_layer);
707 data.SetInteractionMask(operator);
708
709 data.m_IntTarget = val;
710 data.m_IntLast = data.m_IntCurrent;
711 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
712 {
713 data.SetSettingDefaultValues(false);
714 data.SetDataActive(true);
715
717 }
718 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
719 }
720
721 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
722 {
723 //TODO - running check and cleanup rework (elsewhere!)
725 return;
726
727 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
728 data.m_IntLast = data.m_IntCurrent;
729 if (!data.IsSettingDefaultValues())
730 {
731 data.SetSettingDefaultValues(true);
732
734 }
735 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
736 }
737
738 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
739 {
741 return;
742
744 data.SetPriorityLayer(priority_layer);
745 data.SetInteractionMask(operator);
746
747 data.m_FloatFormerTarget = data.m_FloatTarget;
748 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
749 data.m_FloatLast = data.m_FloatCurrent;
750 data.m_FloatStart = data.m_FloatCurrent;
751 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
752 {
753 data.SetSettingDefaultValues(false);
754 data.SetDataActive(true);
755
757 }
758 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
759 }
760
761 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
762 {
763 //TODO - running check and cleanup rework (elsewhere!)
765 return;
766
768 data.m_FloatFormerTarget = data.m_FloatTarget;
769 data.m_FloatLast = data.m_FloatCurrent;
770 data.m_FloatStart = data.m_FloatCurrent;
771 if (!data.IsSettingDefaultValues())
772 {
773 data.SetSettingDefaultValues(true);
774
776 }
777 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
778 }
779
780 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
781 {
783 return;
784
785 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
786 data.SetPriorityLayer(priority_layer);
787 data.SetInteractionMask(operator);
788 data.m_ColorFormerTarget = data.m_ColorTarget;
789
790 data.m_ColorTarget.Copy(val);
791
792 data.m_ColorLast = data.m_ColorCurrent;
793 data.m_ColorStart = data.m_ColorCurrent;
794 //if (data.m_ColorTarget != data.m_ColorCurrent)
795 {
796 data.SetSettingDefaultValues(false);
797 data.SetDataActive(true);
798
800 }
801 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
802 }
803
804 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
805 {
806 //TODO - running check and cleanup rework (elsewhere!)
808 return;
809
810 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
811 data.m_ColorFormerTarget = data.m_ColorTarget;
812 data.m_ColorLast = data.m_ColorCurrent;
813 data.m_ColorStart = data.m_ColorCurrent;
814 if (!data.IsSettingDefaultValues())
815 {
816 data.SetSettingDefaultValues(true);
817
819 }
820 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
821 }
822
823 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
824 {
825 }
826
827 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
828 {
829 }*/
830
831 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
832 {
833 }*/
834
836 protected void QueueValuesSend()
837 {
838 m_ValuesSent = false;
839 //m_IsRunning = true;
841 }
842
845 {
848 {
851 else
852 {
855 }
856 }
857 else
858 {
861 temp_map.Set(param_idx, data);
863 }
864
865 if (!data)
866 Error("GetRequestData | no data found in the structure");
867
868 data.m_Requester = this;
869
870 return data;
871 }
872
873 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
874 {
876 switch (type)
877 {
878 case PPEConstants.VAR_TYPE_BOOL:
880 break;
881
882 case PPEConstants.VAR_TYPE_INT:
883 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
884 break;
885
886 case PPEConstants.VAR_TYPE_FLOAT:
888 break;
889
890 case PPEConstants.VAR_TYPE_COLOR:
891 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
892 break;
893 }
894 return data;
895 }
896
897 // unused?
899 {
901 }
902
903 protected void ClearRequesterData()
904 {
906 }
907
909 {
910 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
911 }
912
913 //EVENTS//
914 //vvvvvv//
915 void OnUpdate(float delta)
916 {
917 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
918
919 if (!m_ValuesSent)
920 {
921 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
922 {
923 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
924 {
925 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
926 }
927 }
928 m_ValuesSent = true;
929 }
931 }
932
933 protected void OnStart(Param par = null)
934 {
936 }
937
939 protected void OnStop(Param par = null)
940 {
941 //DbgPrnt("PPEDebug | " + this + " | OnStop");
944 }
945
947 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
948 {
949 float ret = value;
950 if (!relative) //if not already relative...
951 {
952 switch (var_type)
953 {
954 case PPEConstants.VAR_TYPE_FLOAT:
956 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
957 ret = Math.Clamp(ret, 0.0, 1.0);
958 break;
959 }
960 }
961 //Print("RelativizeValue: " + ret);
962
963 return ret;
964 }
965
967 protected void SetDefaultValuesAll()
968 {
969 //<material<param_id,data>>
971
972 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
973 {
974 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
975 {
976 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
977
978 if (!req_data.IsDataActive())
979 continue;
980
981 switch (req_data.GetVarType())
982 {
983 case PPEConstants.VAR_TYPE_BOOL:
984 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
985 break;
986
987 case PPEConstants.VAR_TYPE_INT:
988 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
989 break;
990
991 case PPEConstants.VAR_TYPE_FLOAT:
992 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
993 break;
994
995 case PPEConstants.VAR_TYPE_COLOR:
996 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
997 break;
998 }
999 }
1000 }
1001 }
1002
1003 void DbgPrnt(string text)
1004 {
1005 //Debug.Log(""+text);
1006 }
1007}
1008
1010// Base requester platforms //
1012
1014{
1015 override int GetCategoryMask()
1016 {
1017 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1018 }
1019}
1020
1022{
1023 override int GetCategoryMask()
1024 {
1025 return PPERequesterCategory.MENU_EFFECTS;
1026 }
1027}

Referenced by PPERequester_GameplayBase::OnStart(), PPERequester_MenuBase::OnStart(), PPERequester_GameplayBase::OnUpdate(), PPERequester_GameplayBase::SetBloodLossLevel(), PPERequester_MenuBase::SetBlurIntensity(), PPERequester_GameplayBase::SetEyeAccommodation(), PPERequester_GameplayBase::SetFeverIntensity(), PPERequester_GameplayBase::SetFlashbangIntensity(), PPERequester_GameplayBase::SetHitIntensity(), PPERequester_GameplayBase::SetNVMode(), PPERequester_GameplayBase::SetRadialBlur(), PPERequester_GameplayBase::SetValuesIronsights(), PPERequester_GameplayBase::SetValuesOptics(), and PPERequester_MenuBase::SetVignetteIntensity().

◆ SetTargetValueFloatDefault()

void GetCategoryMask::SetTargetValueFloatDefault ( int mat_id,
int param_idx )
protected

Definition at line 607 of file PPERequestPlatformsBase.c.

609{
610 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
611 protected bool m_ValuesSent;
612 protected int m_IDX;
613
614 protected bool m_Valid = false;
615
616 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
617
619 {
620 m_Valid = PPERequesterBank.VerifyRequester(this);
621
623 m_ValuesSent = true;
624 m_IsRunning = false;
626 }
627
629 void SetRequesterUpdating(bool state)
630 {
631 if (!m_Valid)
632 {
633 Debug.Log("" + this + " not valid!");
634 return;
635 }
636
637 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
638
639 //TODO - separate into its own function?
640 if (state)
641 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
642 }
643
644 void Start(Param par = null)
645 {
646 OnStart(par);
647 m_IsRunning = true;
648 }
649
650 void Stop(Param par = null)
651 {
653 return;
654
655 OnStop(par);
656 m_IsRunning = false;
657 }
658
659 bool IsRequesterRunning()
660 {
661 return m_IsRunning;
662 }
663
665 void SetRequesterIDX(int idx)
666 {
667 m_IDX = idx;
668 }
669
671 int GetRequesterIDX()
672 {
673 return m_IDX;
674 }
675
677 int GetCategoryMask()
678 {
679 return PPERequesterCategory.NONE;
680 }
681
682 //SETTERS//
683 //vvvvvvv//
684 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
685 {
687 return;
688
690 data.SetPriorityLayer(priority_layer);
691 data.SetInteractionMask(operator);
692
693 data.m_BoolTarget = val;
694 data.m_BoolLast = data.m_BoolCurrent;
695
696 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
697 {
698 data.SetSettingDefaultValues(false);
699 data.SetDataActive(true);
700
702 }
703 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
704 }
705
706 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
707 {
708 //TODO - running check and cleanup rework (elsewhere!)
710 return;
711
713 data.m_BoolLast = data.m_BoolCurrent;
714 if (!data.IsSettingDefaultValues())
715 {
716 data.SetSettingDefaultValues(true);
717
719 }
720 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
721 }
722
723 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
724 {
726 return;
727
728 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
729 data.SetPriorityLayer(priority_layer);
730 data.SetInteractionMask(operator);
731
732 data.m_IntTarget = val;
733 data.m_IntLast = data.m_IntCurrent;
734 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
735 {
736 data.SetSettingDefaultValues(false);
737 data.SetDataActive(true);
738
740 }
741 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
742 }
743
744 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
745 {
746 //TODO - running check and cleanup rework (elsewhere!)
748 return;
749
750 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
751 data.m_IntLast = data.m_IntCurrent;
752 if (!data.IsSettingDefaultValues())
753 {
754 data.SetSettingDefaultValues(true);
755
757 }
758 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
759 }
760
761 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
762 {
764 return;
765
767 data.SetPriorityLayer(priority_layer);
768 data.SetInteractionMask(operator);
769
770 data.m_FloatFormerTarget = data.m_FloatTarget;
771 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
772 data.m_FloatLast = data.m_FloatCurrent;
773 data.m_FloatStart = data.m_FloatCurrent;
774 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
775 {
776 data.SetSettingDefaultValues(false);
777 data.SetDataActive(true);
778
780 }
781 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
782 }
783
784 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
785 {
786 //TODO - running check and cleanup rework (elsewhere!)
788 return;
789
791 data.m_FloatFormerTarget = data.m_FloatTarget;
792 data.m_FloatLast = data.m_FloatCurrent;
793 data.m_FloatStart = data.m_FloatCurrent;
794 if (!data.IsSettingDefaultValues())
795 {
796 data.SetSettingDefaultValues(true);
797
799 }
800 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
801 }
802
803 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
804 {
806 return;
807
808 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
809 data.SetPriorityLayer(priority_layer);
810 data.SetInteractionMask(operator);
811 data.m_ColorFormerTarget = data.m_ColorTarget;
812
813 data.m_ColorTarget.Copy(val);
814
815 data.m_ColorLast = data.m_ColorCurrent;
816 data.m_ColorStart = data.m_ColorCurrent;
817 //if (data.m_ColorTarget != data.m_ColorCurrent)
818 {
819 data.SetSettingDefaultValues(false);
820 data.SetDataActive(true);
821
823 }
824 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
825 }
826
827 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
828 {
829 //TODO - running check and cleanup rework (elsewhere!)
831 return;
832
833 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
834 data.m_ColorFormerTarget = data.m_ColorTarget;
835 data.m_ColorLast = data.m_ColorCurrent;
836 data.m_ColorStart = data.m_ColorCurrent;
837 if (!data.IsSettingDefaultValues())
838 {
839 data.SetSettingDefaultValues(true);
840
842 }
843 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
844 }
845
846 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
847 {
848 }
849
850 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
851 {
852 }*/
853
854 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
855 {
856 }*/
857
859 protected void QueueValuesSend()
860 {
861 m_ValuesSent = false;
862 //m_IsRunning = true;
864 }
865
868 {
871 {
874 else
875 {
878 }
879 }
880 else
881 {
884 temp_map.Set(param_idx, data);
886 }
887
888 if (!data)
889 Error("GetRequestData | no data found in the structure");
890
891 data.m_Requester = this;
892
893 return data;
894 }
895
896 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
897 {
899 switch (type)
900 {
901 case PPEConstants.VAR_TYPE_BOOL:
903 break;
904
905 case PPEConstants.VAR_TYPE_INT:
906 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
907 break;
908
909 case PPEConstants.VAR_TYPE_FLOAT:
911 break;
912
913 case PPEConstants.VAR_TYPE_COLOR:
914 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
915 break;
916 }
917 return data;
918 }
919
920 // unused?
922 {
924 }
925
926 protected void ClearRequesterData()
927 {
929 }
930
932 {
933 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
934 }
935
936 //EVENTS//
937 //vvvvvv//
938 void OnUpdate(float delta)
939 {
940 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
941
942 if (!m_ValuesSent)
943 {
944 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
945 {
946 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
947 {
948 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
949 }
950 }
951 m_ValuesSent = true;
952 }
954 }
955
956 protected void OnStart(Param par = null)
957 {
959 }
960
962 protected void OnStop(Param par = null)
963 {
964 //DbgPrnt("PPEDebug | " + this + " | OnStop");
967 }
968
970 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
971 {
972 float ret = value;
973 if (!relative) //if not already relative...
974 {
975 switch (var_type)
976 {
977 case PPEConstants.VAR_TYPE_FLOAT:
979 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
980 ret = Math.Clamp(ret, 0.0, 1.0);
981 break;
982 }
983 }
984 //Print("RelativizeValue: " + ret);
985
986 return ret;
987 }
988
990 protected void SetDefaultValuesAll()
991 {
992 //<material<param_id,data>>
994
995 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
996 {
997 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
998 {
999 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
1000
1001 if (!req_data.IsDataActive())
1002 continue;
1003
1004 switch (req_data.GetVarType())
1005 {
1006 case PPEConstants.VAR_TYPE_BOOL:
1007 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1008 break;
1009
1010 case PPEConstants.VAR_TYPE_INT:
1011 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1012 break;
1013
1014 case PPEConstants.VAR_TYPE_FLOAT:
1015 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1016 break;
1017
1018 case PPEConstants.VAR_TYPE_COLOR:
1019 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
1020 break;
1021 }
1022 }
1023 }
1024 }
1025
1026 void DbgPrnt(string text)
1027 {
1028 //Debug.Log(""+text);
1029 }
1030}
1031
1033// Base requester platforms //
1035
1037{
1038 override int GetCategoryMask()
1039 {
1040 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1041 }
1042}
1043
1045{
1046 override int GetCategoryMask()
1047 {
1048 return PPERequesterCategory.MENU_EFFECTS;
1049 }
1050}

Referenced by PPERequester_GameplayBase::SetNVMode(), and PPERequester_GameplayBase::SetValuesIronsights().

◆ SetTargetValueInt()

void GetCategoryMask::SetTargetValueInt ( int mat_id,
int param_idx,
bool relative,
int val,
int priority_layer,
int operator = PPOperators.SET )
protected

Definition at line 546 of file PPERequestPlatformsBase.c.

548{
549 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
550 protected bool m_ValuesSent;
551 protected int m_IDX;
552
553 protected bool m_Valid = false;
554
555 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
556
558 {
559 m_Valid = PPERequesterBank.VerifyRequester(this);
560
562 m_ValuesSent = true;
563 m_IsRunning = false;
565 }
566
568 void SetRequesterUpdating(bool state)
569 {
570 if (!m_Valid)
571 {
572 Debug.Log("" + this + " not valid!");
573 return;
574 }
575
576 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
577
578 //TODO - separate into its own function?
579 if (state)
580 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
581 }
582
583 void Start(Param par = null)
584 {
585 OnStart(par);
586 m_IsRunning = true;
587 }
588
589 void Stop(Param par = null)
590 {
592 return;
593
594 OnStop(par);
595 m_IsRunning = false;
596 }
597
598 bool IsRequesterRunning()
599 {
600 return m_IsRunning;
601 }
602
604 void SetRequesterIDX(int idx)
605 {
606 m_IDX = idx;
607 }
608
610 int GetRequesterIDX()
611 {
612 return m_IDX;
613 }
614
616 int GetCategoryMask()
617 {
618 return PPERequesterCategory.NONE;
619 }
620
621 //SETTERS//
622 //vvvvvvv//
623 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
624 {
626 return;
627
629 data.SetPriorityLayer(priority_layer);
630 data.SetInteractionMask(operator);
631
632 data.m_BoolTarget = val;
633 data.m_BoolLast = data.m_BoolCurrent;
634
635 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
636 {
637 data.SetSettingDefaultValues(false);
638 data.SetDataActive(true);
639
641 }
642 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
643 }
644
645 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
646 {
647 //TODO - running check and cleanup rework (elsewhere!)
649 return;
650
652 data.m_BoolLast = data.m_BoolCurrent;
653 if (!data.IsSettingDefaultValues())
654 {
655 data.SetSettingDefaultValues(true);
656
658 }
659 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
660 }
661
662 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
663 {
665 return;
666
667 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
668 data.SetPriorityLayer(priority_layer);
669 data.SetInteractionMask(operator);
670
671 data.m_IntTarget = val;
672 data.m_IntLast = data.m_IntCurrent;
673 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
674 {
675 data.SetSettingDefaultValues(false);
676 data.SetDataActive(true);
677
679 }
680 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
681 }
682
683 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
684 {
685 //TODO - running check and cleanup rework (elsewhere!)
687 return;
688
689 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
690 data.m_IntLast = data.m_IntCurrent;
691 if (!data.IsSettingDefaultValues())
692 {
693 data.SetSettingDefaultValues(true);
694
696 }
697 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
698 }
699
700 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
701 {
703 return;
704
706 data.SetPriorityLayer(priority_layer);
707 data.SetInteractionMask(operator);
708
709 data.m_FloatFormerTarget = data.m_FloatTarget;
710 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
711 data.m_FloatLast = data.m_FloatCurrent;
712 data.m_FloatStart = data.m_FloatCurrent;
713 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
714 {
715 data.SetSettingDefaultValues(false);
716 data.SetDataActive(true);
717
719 }
720 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
721 }
722
723 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
724 {
725 //TODO - running check and cleanup rework (elsewhere!)
727 return;
728
730 data.m_FloatFormerTarget = data.m_FloatTarget;
731 data.m_FloatLast = data.m_FloatCurrent;
732 data.m_FloatStart = data.m_FloatCurrent;
733 if (!data.IsSettingDefaultValues())
734 {
735 data.SetSettingDefaultValues(true);
736
738 }
739 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
740 }
741
742 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
743 {
745 return;
746
747 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
748 data.SetPriorityLayer(priority_layer);
749 data.SetInteractionMask(operator);
750 data.m_ColorFormerTarget = data.m_ColorTarget;
751
752 data.m_ColorTarget.Copy(val);
753
754 data.m_ColorLast = data.m_ColorCurrent;
755 data.m_ColorStart = data.m_ColorCurrent;
756 //if (data.m_ColorTarget != data.m_ColorCurrent)
757 {
758 data.SetSettingDefaultValues(false);
759 data.SetDataActive(true);
760
762 }
763 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
764 }
765
766 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
767 {
768 //TODO - running check and cleanup rework (elsewhere!)
770 return;
771
772 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
773 data.m_ColorFormerTarget = data.m_ColorTarget;
774 data.m_ColorLast = data.m_ColorCurrent;
775 data.m_ColorStart = data.m_ColorCurrent;
776 if (!data.IsSettingDefaultValues())
777 {
778 data.SetSettingDefaultValues(true);
779
781 }
782 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
783 }
784
785 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
786 {
787 }
788
789 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
790 {
791 }*/
792
793 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
794 {
795 }*/
796
798 protected void QueueValuesSend()
799 {
800 m_ValuesSent = false;
801 //m_IsRunning = true;
803 }
804
807 {
810 {
813 else
814 {
817 }
818 }
819 else
820 {
823 temp_map.Set(param_idx, data);
825 }
826
827 if (!data)
828 Error("GetRequestData | no data found in the structure");
829
830 data.m_Requester = this;
831
832 return data;
833 }
834
835 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
836 {
838 switch (type)
839 {
840 case PPEConstants.VAR_TYPE_BOOL:
842 break;
843
844 case PPEConstants.VAR_TYPE_INT:
845 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
846 break;
847
848 case PPEConstants.VAR_TYPE_FLOAT:
850 break;
851
852 case PPEConstants.VAR_TYPE_COLOR:
853 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
854 break;
855 }
856 return data;
857 }
858
859 // unused?
861 {
863 }
864
865 protected void ClearRequesterData()
866 {
868 }
869
871 {
872 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
873 }
874
875 //EVENTS//
876 //vvvvvv//
877 void OnUpdate(float delta)
878 {
879 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
880
881 if (!m_ValuesSent)
882 {
883 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
884 {
885 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
886 {
887 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
888 }
889 }
890 m_ValuesSent = true;
891 }
893 }
894
895 protected void OnStart(Param par = null)
896 {
898 }
899
901 protected void OnStop(Param par = null)
902 {
903 //DbgPrnt("PPEDebug | " + this + " | OnStop");
906 }
907
909 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
910 {
911 float ret = value;
912 if (!relative) //if not already relative...
913 {
914 switch (var_type)
915 {
916 case PPEConstants.VAR_TYPE_FLOAT:
918 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
919 ret = Math.Clamp(ret, 0.0, 1.0);
920 break;
921 }
922 }
923 //Print("RelativizeValue: " + ret);
924
925 return ret;
926 }
927
929 protected void SetDefaultValuesAll()
930 {
931 //<material<param_id,data>>
933
934 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
935 {
936 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
937 {
938 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
939
940 if (!req_data.IsDataActive())
941 continue;
942
943 switch (req_data.GetVarType())
944 {
945 case PPEConstants.VAR_TYPE_BOOL:
946 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
947 break;
948
949 case PPEConstants.VAR_TYPE_INT:
950 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
951 break;
952
953 case PPEConstants.VAR_TYPE_FLOAT:
954 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
955 break;
956
957 case PPEConstants.VAR_TYPE_COLOR:
958 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
959 break;
960 }
961 }
962 }
963 }
964
965 void DbgPrnt(string text)
966 {
967 //Debug.Log(""+text);
968 }
969}
970
972// Base requester platforms //
974
976{
977 override int GetCategoryMask()
978 {
979 return PPERequesterCategory.GAMEPLAY_EFFECTS;
980 }
981}
982
984{
985 override int GetCategoryMask()
986 {
987 return PPERequesterCategory.MENU_EFFECTS;
988 }
989}

◆ SetTargetValueIntDefault()

void GetCategoryMask::SetTargetValueIntDefault ( int mat_id,
int param_idx )
protected

Definition at line 567 of file PPERequestPlatformsBase.c.

569{
570 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
571 protected bool m_ValuesSent;
572 protected int m_IDX;
573
574 protected bool m_Valid = false;
575
576 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
577
579 {
580 m_Valid = PPERequesterBank.VerifyRequester(this);
581
583 m_ValuesSent = true;
584 m_IsRunning = false;
586 }
587
589 void SetRequesterUpdating(bool state)
590 {
591 if (!m_Valid)
592 {
593 Debug.Log("" + this + " not valid!");
594 return;
595 }
596
597 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
598
599 //TODO - separate into its own function?
600 if (state)
601 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
602 }
603
604 void Start(Param par = null)
605 {
606 OnStart(par);
607 m_IsRunning = true;
608 }
609
610 void Stop(Param par = null)
611 {
613 return;
614
615 OnStop(par);
616 m_IsRunning = false;
617 }
618
619 bool IsRequesterRunning()
620 {
621 return m_IsRunning;
622 }
623
625 void SetRequesterIDX(int idx)
626 {
627 m_IDX = idx;
628 }
629
631 int GetRequesterIDX()
632 {
633 return m_IDX;
634 }
635
637 int GetCategoryMask()
638 {
639 return PPERequesterCategory.NONE;
640 }
641
642 //SETTERS//
643 //vvvvvvv//
644 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
645 {
647 return;
648
650 data.SetPriorityLayer(priority_layer);
651 data.SetInteractionMask(operator);
652
653 data.m_BoolTarget = val;
654 data.m_BoolLast = data.m_BoolCurrent;
655
656 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
657 {
658 data.SetSettingDefaultValues(false);
659 data.SetDataActive(true);
660
662 }
663 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
664 }
665
666 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
667 {
668 //TODO - running check and cleanup rework (elsewhere!)
670 return;
671
673 data.m_BoolLast = data.m_BoolCurrent;
674 if (!data.IsSettingDefaultValues())
675 {
676 data.SetSettingDefaultValues(true);
677
679 }
680 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
681 }
682
683 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
684 {
686 return;
687
688 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
689 data.SetPriorityLayer(priority_layer);
690 data.SetInteractionMask(operator);
691
692 data.m_IntTarget = val;
693 data.m_IntLast = data.m_IntCurrent;
694 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
695 {
696 data.SetSettingDefaultValues(false);
697 data.SetDataActive(true);
698
700 }
701 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
702 }
703
704 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
705 {
706 //TODO - running check and cleanup rework (elsewhere!)
708 return;
709
710 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
711 data.m_IntLast = data.m_IntCurrent;
712 if (!data.IsSettingDefaultValues())
713 {
714 data.SetSettingDefaultValues(true);
715
717 }
718 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
719 }
720
721 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
722 {
724 return;
725
727 data.SetPriorityLayer(priority_layer);
728 data.SetInteractionMask(operator);
729
730 data.m_FloatFormerTarget = data.m_FloatTarget;
731 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
732 data.m_FloatLast = data.m_FloatCurrent;
733 data.m_FloatStart = data.m_FloatCurrent;
734 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
735 {
736 data.SetSettingDefaultValues(false);
737 data.SetDataActive(true);
738
740 }
741 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
742 }
743
744 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
745 {
746 //TODO - running check and cleanup rework (elsewhere!)
748 return;
749
751 data.m_FloatFormerTarget = data.m_FloatTarget;
752 data.m_FloatLast = data.m_FloatCurrent;
753 data.m_FloatStart = data.m_FloatCurrent;
754 if (!data.IsSettingDefaultValues())
755 {
756 data.SetSettingDefaultValues(true);
757
759 }
760 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
761 }
762
763 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
764 {
766 return;
767
768 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
769 data.SetPriorityLayer(priority_layer);
770 data.SetInteractionMask(operator);
771 data.m_ColorFormerTarget = data.m_ColorTarget;
772
773 data.m_ColorTarget.Copy(val);
774
775 data.m_ColorLast = data.m_ColorCurrent;
776 data.m_ColorStart = data.m_ColorCurrent;
777 //if (data.m_ColorTarget != data.m_ColorCurrent)
778 {
779 data.SetSettingDefaultValues(false);
780 data.SetDataActive(true);
781
783 }
784 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
785 }
786
787 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
788 {
789 //TODO - running check and cleanup rework (elsewhere!)
791 return;
792
793 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
794 data.m_ColorFormerTarget = data.m_ColorTarget;
795 data.m_ColorLast = data.m_ColorCurrent;
796 data.m_ColorStart = data.m_ColorCurrent;
797 if (!data.IsSettingDefaultValues())
798 {
799 data.SetSettingDefaultValues(true);
800
802 }
803 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
804 }
805
806 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
807 {
808 }
809
810 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
811 {
812 }*/
813
814 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
815 {
816 }*/
817
819 protected void QueueValuesSend()
820 {
821 m_ValuesSent = false;
822 //m_IsRunning = true;
824 }
825
828 {
831 {
834 else
835 {
838 }
839 }
840 else
841 {
844 temp_map.Set(param_idx, data);
846 }
847
848 if (!data)
849 Error("GetRequestData | no data found in the structure");
850
851 data.m_Requester = this;
852
853 return data;
854 }
855
856 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
857 {
859 switch (type)
860 {
861 case PPEConstants.VAR_TYPE_BOOL:
863 break;
864
865 case PPEConstants.VAR_TYPE_INT:
866 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
867 break;
868
869 case PPEConstants.VAR_TYPE_FLOAT:
871 break;
872
873 case PPEConstants.VAR_TYPE_COLOR:
874 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
875 break;
876 }
877 return data;
878 }
879
880 // unused?
882 {
884 }
885
886 protected void ClearRequesterData()
887 {
889 }
890
892 {
893 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
894 }
895
896 //EVENTS//
897 //vvvvvv//
898 void OnUpdate(float delta)
899 {
900 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
901
902 if (!m_ValuesSent)
903 {
904 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
905 {
906 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
907 {
908 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
909 }
910 }
911 m_ValuesSent = true;
912 }
914 }
915
916 protected void OnStart(Param par = null)
917 {
919 }
920
922 protected void OnStop(Param par = null)
923 {
924 //DbgPrnt("PPEDebug | " + this + " | OnStop");
927 }
928
930 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
931 {
932 float ret = value;
933 if (!relative) //if not already relative...
934 {
935 switch (var_type)
936 {
937 case PPEConstants.VAR_TYPE_FLOAT:
939 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
940 ret = Math.Clamp(ret, 0.0, 1.0);
941 break;
942 }
943 }
944 //Print("RelativizeValue: " + ret);
945
946 return ret;
947 }
948
950 protected void SetDefaultValuesAll()
951 {
952 //<material<param_id,data>>
954
955 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
956 {
957 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
958 {
959 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
960
961 if (!req_data.IsDataActive())
962 continue;
963
964 switch (req_data.GetVarType())
965 {
966 case PPEConstants.VAR_TYPE_BOOL:
967 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
968 break;
969
970 case PPEConstants.VAR_TYPE_INT:
971 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
972 break;
973
974 case PPEConstants.VAR_TYPE_FLOAT:
975 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
976 break;
977
978 case PPEConstants.VAR_TYPE_COLOR:
979 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
980 break;
981 }
982 }
983 }
984 }
985
986 void DbgPrnt(string text)
987 {
988 //Debug.Log(""+text);
989 }
990}
991
993// Base requester platforms //
995
997{
998 override int GetCategoryMask()
999 {
1000 return PPERequesterCategory.GAMEPLAY_EFFECTS;
1001 }
1002}
1003
1005{
1006 override int GetCategoryMask()
1007 {
1008 return PPERequesterCategory.MENU_EFFECTS;
1009 }
1010}

◆ Start()

void GetCategoryMask::Start ( Param par = null)
protected

Definition at line 467 of file PPERequestPlatformsBase.c.

469{
470 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
471 protected bool m_ValuesSent;
472 protected int m_IDX;
473
474 protected bool m_Valid = false;
475
476 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
477
479 {
480 m_Valid = PPERequesterBank.VerifyRequester(this);
481
483 m_ValuesSent = true;
484 m_IsRunning = false;
486 }
487
489 void SetRequesterUpdating(bool state)
490 {
491 if (!m_Valid)
492 {
493 Debug.Log("" + this + " not valid!");
494 return;
495 }
496
497 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
498
499 //TODO - separate into its own function?
500 if (state)
501 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
502 }
503
504 void Start(Param par = null)
505 {
506 OnStart(par);
507 m_IsRunning = true;
508 }
509
510 void Stop(Param par = null)
511 {
513 return;
514
515 OnStop(par);
516 m_IsRunning = false;
517 }
518
519 bool IsRequesterRunning()
520 {
521 return m_IsRunning;
522 }
523
525 void SetRequesterIDX(int idx)
526 {
527 m_IDX = idx;
528 }
529
531 int GetRequesterIDX()
532 {
533 return m_IDX;
534 }
535
537 int GetCategoryMask()
538 {
539 return PPERequesterCategory.NONE;
540 }
541
542 //SETTERS//
543 //vvvvvvv//
544 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
545 {
547 return;
548
550 data.SetPriorityLayer(priority_layer);
551 data.SetInteractionMask(operator);
552
553 data.m_BoolTarget = val;
554 data.m_BoolLast = data.m_BoolCurrent;
555
556 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
557 {
558 data.SetSettingDefaultValues(false);
559 data.SetDataActive(true);
560
562 }
563 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
564 }
565
566 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
567 {
568 //TODO - running check and cleanup rework (elsewhere!)
570 return;
571
573 data.m_BoolLast = data.m_BoolCurrent;
574 if (!data.IsSettingDefaultValues())
575 {
576 data.SetSettingDefaultValues(true);
577
579 }
580 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
581 }
582
583 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
584 {
586 return;
587
588 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
589 data.SetPriorityLayer(priority_layer);
590 data.SetInteractionMask(operator);
591
592 data.m_IntTarget = val;
593 data.m_IntLast = data.m_IntCurrent;
594 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
595 {
596 data.SetSettingDefaultValues(false);
597 data.SetDataActive(true);
598
600 }
601 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
602 }
603
604 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
605 {
606 //TODO - running check and cleanup rework (elsewhere!)
608 return;
609
610 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
611 data.m_IntLast = data.m_IntCurrent;
612 if (!data.IsSettingDefaultValues())
613 {
614 data.SetSettingDefaultValues(true);
615
617 }
618 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
619 }
620
621 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
622 {
624 return;
625
627 data.SetPriorityLayer(priority_layer);
628 data.SetInteractionMask(operator);
629
630 data.m_FloatFormerTarget = data.m_FloatTarget;
631 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
632 data.m_FloatLast = data.m_FloatCurrent;
633 data.m_FloatStart = data.m_FloatCurrent;
634 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
635 {
636 data.SetSettingDefaultValues(false);
637 data.SetDataActive(true);
638
640 }
641 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
642 }
643
644 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
645 {
646 //TODO - running check and cleanup rework (elsewhere!)
648 return;
649
651 data.m_FloatFormerTarget = data.m_FloatTarget;
652 data.m_FloatLast = data.m_FloatCurrent;
653 data.m_FloatStart = data.m_FloatCurrent;
654 if (!data.IsSettingDefaultValues())
655 {
656 data.SetSettingDefaultValues(true);
657
659 }
660 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
661 }
662
663 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
664 {
666 return;
667
668 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
669 data.SetPriorityLayer(priority_layer);
670 data.SetInteractionMask(operator);
671 data.m_ColorFormerTarget = data.m_ColorTarget;
672
673 data.m_ColorTarget.Copy(val);
674
675 data.m_ColorLast = data.m_ColorCurrent;
676 data.m_ColorStart = data.m_ColorCurrent;
677 //if (data.m_ColorTarget != data.m_ColorCurrent)
678 {
679 data.SetSettingDefaultValues(false);
680 data.SetDataActive(true);
681
683 }
684 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
685 }
686
687 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
688 {
689 //TODO - running check and cleanup rework (elsewhere!)
691 return;
692
693 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
694 data.m_ColorFormerTarget = data.m_ColorTarget;
695 data.m_ColorLast = data.m_ColorCurrent;
696 data.m_ColorStart = data.m_ColorCurrent;
697 if (!data.IsSettingDefaultValues())
698 {
699 data.SetSettingDefaultValues(true);
700
702 }
703 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
704 }
705
706 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
707 {
708 }
709
710 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
711 {
712 }*/
713
714 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
715 {
716 }*/
717
719 protected void QueueValuesSend()
720 {
721 m_ValuesSent = false;
722 //m_IsRunning = true;
724 }
725
728 {
731 {
734 else
735 {
738 }
739 }
740 else
741 {
744 temp_map.Set(param_idx, data);
746 }
747
748 if (!data)
749 Error("GetRequestData | no data found in the structure");
750
751 data.m_Requester = this;
752
753 return data;
754 }
755
756 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
757 {
759 switch (type)
760 {
761 case PPEConstants.VAR_TYPE_BOOL:
763 break;
764
765 case PPEConstants.VAR_TYPE_INT:
766 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
767 break;
768
769 case PPEConstants.VAR_TYPE_FLOAT:
771 break;
772
773 case PPEConstants.VAR_TYPE_COLOR:
774 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
775 break;
776 }
777 return data;
778 }
779
780 // unused?
782 {
784 }
785
786 protected void ClearRequesterData()
787 {
789 }
790
792 {
793 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
794 }
795
796 //EVENTS//
797 //vvvvvv//
798 void OnUpdate(float delta)
799 {
800 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
801
802 if (!m_ValuesSent)
803 {
804 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
805 {
806 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
807 {
808 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
809 }
810 }
811 m_ValuesSent = true;
812 }
814 }
815
816 protected void OnStart(Param par = null)
817 {
819 }
820
822 protected void OnStop(Param par = null)
823 {
824 //DbgPrnt("PPEDebug | " + this + " | OnStop");
827 }
828
830 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
831 {
832 float ret = value;
833 if (!relative) //if not already relative...
834 {
835 switch (var_type)
836 {
837 case PPEConstants.VAR_TYPE_FLOAT:
839 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
840 ret = Math.Clamp(ret, 0.0, 1.0);
841 break;
842 }
843 }
844 //Print("RelativizeValue: " + ret);
845
846 return ret;
847 }
848
850 protected void SetDefaultValuesAll()
851 {
852 //<material<param_id,data>>
854
855 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
856 {
857 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
858 {
859 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
860
861 if (!req_data.IsDataActive())
862 continue;
863
864 switch (req_data.GetVarType())
865 {
866 case PPEConstants.VAR_TYPE_BOOL:
867 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
868 break;
869
870 case PPEConstants.VAR_TYPE_INT:
871 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
872 break;
873
874 case PPEConstants.VAR_TYPE_FLOAT:
875 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
876 break;
877
878 case PPEConstants.VAR_TYPE_COLOR:
879 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
880 break;
881 }
882 }
883 }
884 }
885
886 void DbgPrnt(string text)
887 {
888 //Debug.Log(""+text);
889 }
890}
891
893// Base requester platforms //
895
897{
898 override int GetCategoryMask()
899 {
900 return PPERequesterCategory.GAMEPLAY_EFFECTS;
901 }
902}
903
905{
906 override int GetCategoryMask()
907 {
908 return PPERequesterCategory.MENU_EFFECTS;
909 }
910}

◆ Stop()

void GetCategoryMask::Stop ( Param par = null)
protected

Definition at line 473 of file PPERequestPlatformsBase.c.

475{
476 protected bool m_IsRunning; //helps determine if the requester has been stopped or not
477 protected bool m_ValuesSent;
478 protected int m_IDX;
479
480 protected bool m_Valid = false;
481
482 protected ref map<int, ref map<int, ref PPERequestParamDataBase>> m_RequestDataStructure; // <material<param_id,data>> // parameter data objects are singletons
483
485 {
486 m_Valid = PPERequesterBank.VerifyRequester(this);
487
489 m_ValuesSent = true;
490 m_IsRunning = false;
492 }
493
495 void SetRequesterUpdating(bool state)
496 {
497 if (!m_Valid)
498 {
499 Debug.Log("" + this + " not valid!");
500 return;
501 }
502
503 PPEManagerStatic.GetPPEManager().SetRequestUpdating(this, state);
504
505 //TODO - separate into its own function?
506 if (state)
507 PPEManagerStatic.GetPPEManager().SetRequestActive(this, true);
508 }
509
510 void Start(Param par = null)
511 {
512 OnStart(par);
513 m_IsRunning = true;
514 }
515
516 void Stop(Param par = null)
517 {
519 return;
520
521 OnStop(par);
522 m_IsRunning = false;
523 }
524
525 bool IsRequesterRunning()
526 {
527 return m_IsRunning;
528 }
529
531 void SetRequesterIDX(int idx)
532 {
533 m_IDX = idx;
534 }
535
537 int GetRequesterIDX()
538 {
539 return m_IDX;
540 }
541
543 int GetCategoryMask()
544 {
545 return PPERequesterCategory.NONE;
546 }
547
548 //SETTERS//
549 //vvvvvvv//
550 protected void SetTargetValueBool(int mat_id, int param_idx, bool val, int priority_layer, int operator = PPOperators.SET)
551 {
553 return;
554
556 data.SetPriorityLayer(priority_layer);
557 data.SetInteractionMask(operator);
558
559 data.m_BoolTarget = val;
560 data.m_BoolLast = data.m_BoolCurrent;
561
562 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
563 {
564 data.SetSettingDefaultValues(false);
565 data.SetDataActive(true);
566
568 }
569 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBool | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
570 }
571
572 protected void SetTargetValueBoolDefault(int mat_id, int param_idx)
573 {
574 //TODO - running check and cleanup rework (elsewhere!)
576 return;
577
579 data.m_BoolLast = data.m_BoolCurrent;
580 if (!data.IsSettingDefaultValues())
581 {
582 data.SetSettingDefaultValues(true);
583
585 }
586 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueBoolDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
587 }
588
589 protected void SetTargetValueInt(int mat_id, int param_idx, bool relative, int val, int priority_layer, int operator = PPOperators.SET)
590 {
592 return;
593
594 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
595 data.SetPriorityLayer(priority_layer);
596 data.SetInteractionMask(operator);
597
598 data.m_IntTarget = val;
599 data.m_IntLast = data.m_IntCurrent;
600 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
601 {
602 data.SetSettingDefaultValues(false);
603 data.SetDataActive(true);
604
606 }
607 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueInt | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
608 }
609
610 protected void SetTargetValueIntDefault(int mat_id, int param_idx)
611 {
612 //TODO - running check and cleanup rework (elsewhere!)
614 return;
615
616 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_INT));
617 data.m_IntLast = data.m_IntCurrent;
618 if (!data.IsSettingDefaultValues())
619 {
620 data.SetSettingDefaultValues(true);
621
623 }
624 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueIntDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
625 }
626
627 protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
628 {
630 return;
631
633 data.SetPriorityLayer(priority_layer);
634 data.SetInteractionMask(operator);
635
636 data.m_FloatFormerTarget = data.m_FloatTarget;
637 data.m_FloatTarget = RelativizeValue(val, PPEConstants.VAR_TYPE_FLOAT, mat_id, param_idx, relative);
638 data.m_FloatLast = data.m_FloatCurrent;
639 data.m_FloatStart = data.m_FloatCurrent;
640 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
641 {
642 data.SetSettingDefaultValues(false);
643 data.SetDataActive(true);
644
646 }
647 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloat | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
648 }
649
650 protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
651 {
652 //TODO - running check and cleanup rework (elsewhere!)
654 return;
655
657 data.m_FloatFormerTarget = data.m_FloatTarget;
658 data.m_FloatLast = data.m_FloatCurrent;
659 data.m_FloatStart = data.m_FloatCurrent;
660 if (!data.IsSettingDefaultValues())
661 {
662 data.SetSettingDefaultValues(true);
663
665 }
666 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueFloatDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
667 }
668
669 protected void SetTargetValueColor(int mat_id, int param_idx, ref array<float> val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
670 {
672 return;
673
674 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
675 data.SetPriorityLayer(priority_layer);
676 data.SetInteractionMask(operator);
677 data.m_ColorFormerTarget = data.m_ColorTarget;
678
679 data.m_ColorTarget.Copy(val);
680
681 data.m_ColorLast = data.m_ColorCurrent;
682 data.m_ColorStart = data.m_ColorCurrent;
683 //if (data.m_ColorTarget != data.m_ColorCurrent)
684 {
685 data.SetSettingDefaultValues(false);
686 data.SetDataActive(true);
687
689 }
690 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColor | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
691 }
692
693 protected void SetTargetValueColorDefault(int mat_id, int param_idx)
694 {
695 //TODO - running check and cleanup rework (elsewhere!)
697 return;
698
699 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id, param_idx, PPEConstants.VAR_TYPE_COLOR));
700 data.m_ColorFormerTarget = data.m_ColorTarget;
701 data.m_ColorLast = data.m_ColorCurrent;
702 data.m_ColorStart = data.m_ColorCurrent;
703 if (!data.IsSettingDefaultValues())
704 {
705 data.SetSettingDefaultValues(true);
706
708 }
709 //DbgPrnt("PPEDebug | PPERequesterBase - SetTargetValueColorDefault | mat/par/req: " + mat_id + "/" + param_idx + "/" + m_IDX + " | data: " + data);
710 }
711
712 /*protected void SetTargetValueVector(int mat_id, int param_idx, bool relative, vector val, int priority_layer, int operator = PPOperators.ADD_RELATIVE)
713 {
714 }
715
716 void SetTargetValueTexture(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
717 {
718 }*/
719
720 /*void SetTargetValueResource(int mat_id, int param_idx, string val, int priority_layer, int mask, bool override_priority = false)
721 {
722 }*/
723
725 protected void QueueValuesSend()
726 {
727 m_ValuesSent = false;
728 //m_IsRunning = true;
730 }
731
734 {
737 {
740 else
741 {
744 }
745 }
746 else
747 {
750 temp_map.Set(param_idx, data);
752 }
753
754 if (!data)
755 Error("GetRequestData | no data found in the structure");
756
757 data.m_Requester = this;
758
759 return data;
760 }
761
762 protected PPERequestParamDataBase PrepareData(int mat_id, int param_idx, int type)
763 {
765 switch (type)
766 {
767 case PPEConstants.VAR_TYPE_BOOL:
769 break;
770
771 case PPEConstants.VAR_TYPE_INT:
772 data = new PPERequestParamDataInt(m_IDX, mat_id, param_idx);
773 break;
774
775 case PPEConstants.VAR_TYPE_FLOAT:
777 break;
778
779 case PPEConstants.VAR_TYPE_COLOR:
780 data = new PPERequestParamDataColor(m_IDX, mat_id, param_idx);
781 break;
782 }
783 return data;
784 }
785
786 // unused?
788 {
790 }
791
792 protected void ClearRequesterData()
793 {
795 }
796
798 {
799 PPEManagerStatic.GetPPEManager().SendMaterialValueData(data);
800 }
801
802 //EVENTS//
803 //vvvvvv//
804 void OnUpdate(float delta)
805 {
806 //DbgPrnt("PPEDebug | PPERequesterBase | OnUpdate");
807
808 if (!m_ValuesSent)
809 {
810 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
811 {
812 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
813 {
814 SendCurrentValueData(m_RequestDataStructure.GetElement(i).GetElement(j)); //map<int,ref map<int,PPERequestParamDataBase>> //<material<param,data>>
815 }
816 }
817 m_ValuesSent = true;
818 }
820 }
821
822 protected void OnStart(Param par = null)
823 {
825 }
826
828 protected void OnStop(Param par = null)
829 {
830 //DbgPrnt("PPEDebug | " + this + " | OnStop");
833 }
834
836 protected float RelativizeValue(float value, int var_type, int mat_id, int param_id, bool relative)
837 {
838 float ret = value;
839 if (!relative) //if not already relative...
840 {
841 switch (var_type)
842 {
843 case PPEConstants.VAR_TYPE_FLOAT:
845 ret = Math.InverseLerp(p_float.param3, p_float.param4, ret);
846 ret = Math.Clamp(ret, 0.0, 1.0);
847 break;
848 }
849 }
850 //Print("RelativizeValue: " + ret);
851
852 return ret;
853 }
854
856 protected void SetDefaultValuesAll()
857 {
858 //<material<param_id,data>>
860
861 for (int i = 0; i < m_RequestDataStructure.Count(); i++)
862 {
863 for (int j = 0; j < m_RequestDataStructure.GetElement(i).Count(); j++)
864 {
865 req_data = m_RequestDataStructure.GetElement(i).GetElement(j);
866
867 if (!req_data.IsDataActive())
868 continue;
869
870 switch (req_data.GetVarType())
871 {
872 case PPEConstants.VAR_TYPE_BOOL:
873 SetTargetValueBoolDefault(req_data.GetMaterialID(), req_data.GetParameterID());
874 break;
875
876 case PPEConstants.VAR_TYPE_INT:
877 SetTargetValueIntDefault(req_data.GetMaterialID(), req_data.GetParameterID());
878 break;
879
880 case PPEConstants.VAR_TYPE_FLOAT:
881 SetTargetValueFloatDefault(req_data.GetMaterialID(), req_data.GetParameterID());
882 break;
883
884 case PPEConstants.VAR_TYPE_COLOR:
885 SetTargetValueColorDefault(req_data.GetMaterialID(), req_data.GetParameterID());
886 break;
887 }
888 }
889 }
890 }
891
892 void DbgPrnt(string text)
893 {
894 //Debug.Log(""+text);
895 }
896}
897
899// Base requester platforms //
901
903{
904 override int GetCategoryMask()
905 {
906 return PPERequesterCategory.GAMEPLAY_EFFECTS;
907 }
908}
909
911{
912 override int GetCategoryMask()
913 {
914 return PPERequesterCategory.MENU_EFFECTS;
915 }
916}

Variable Documentation

◆ m_IDX

int m_IDX
protected

Definition at line 435 of file PPERequestPlatformsBase.c.

◆ m_IsRunning

◆ m_RequestDataStructure

ref map<int, ref map<int, ref PPERequestParamDataBase> > m_RequestDataStructure
protected

Definition at line 439 of file PPERequestPlatformsBase.c.

◆ m_Valid

bool m_Valid = false
protected

Definition at line 437 of file PPERequestPlatformsBase.c.

◆ m_ValuesSent

bool m_ValuesSent
protected

Definition at line 434 of file PPERequestPlatformsBase.c.