Ejemplo n.º 1
0
        protected static string ST_ToJsonValue(System.Reflection.FieldInfo[] allprops,
                                               KAU.PlayerSystem.Hidden.IPropertyData myData,
                                               int onIndex)
        {
            string dataJsonValue = null;

            if (allprops.Length == 1)
            {
                // System.Object valueOfObject = allprops[0].GetValue(myData); // Only at runtime? Yes
                KAU.PlayerSystem.IJsonWrapper myDataJsonWrapper = myData.GetJsonWrapper();
                if (onIndex >= 0)
                {
                    System.Collections.IEnumerable getOnIndex = (System.Collections.IEnumerable)allprops[0].GetValue(myData);
                    System.Object currenObject = null;
                    int           findOnIndex  = 0;
                    foreach (var item in getOnIndex)
                    {
                        if (findOnIndex == onIndex)
                        {
                            currenObject = item;
                            break;
                        }
                        findOnIndex++;
                    }

                    myDataJsonWrapper.setData(currenObject);
                }
                else
                {
                    myDataJsonWrapper.setData(allprops[0].GetValue(myData));
                }
                dataJsonValue = myDataJsonWrapper.ToJson();

                // System.Type propTYpe = allprops[0].FieldType; // Only at runtime? No!
                // if (!propTYpe.IsPrimitive)
                // {
                //     System.Type JWarraperGenericTYpe = ST_jsonWrapperType.MakeGenericType(new System.Type[] { propTYpe }); // Only at runtime? No!
                //     dataJsonValue = JsonUtility.ToJson(System.Activator.CreateInstance(JWarraperGenericTYpe, new System.Object[] { valueOfObject }));

                //     if (!string.IsNullOrEmpty(dataJsonValue) && dataJsonValue.Length >= 8)
                //     {
                //         dataJsonValue = dataJsonValue.Substring(8);
                //         dataJsonValue = dataJsonValue.Substring(0, dataJsonValue.Length - 1);
                //     }
                // }
                // else
                //     dataJsonValue = valueOfObject.ToString();
            }
            else
            {
                // Debug.LogWarning(" Multiple props " + allprops.Length);
                dataJsonValue = myData.ToJsonField();
            }
            return(dataJsonValue);
        }
        // Any Other like
        // public long HighScore { get; }
        // or Complex structure
        // public ComplexStructure allScoresFromAllLEvels { get; }

        protected ILeaderBorddata(KAU.PlayerSystem.Hidden.IPropertyData binding) : base(binding)
        {
        }
 protected IProgressManagerUserName(KAU.PlayerSystem.Hidden.IPropertyData binding) : base(binding)
 {
 }
Ejemplo n.º 4
0
 protected IPropertyData(KAU.PlayerSystem.Hidden.IPropertyData binding, KAU.PlayerSystem.ICloneToIData bindToAnothLoc) : base(binding, bindToAnothLoc)
 {
 }
Ejemplo n.º 5
0
 protected IPropertyData(KAU.PlayerSystem.Hidden.IPropertyData myBind)
 {
     _myBind = myBind;
     KAU.Player.ProgressManager.dataHolder.AttachNewListener(this);
 }