Example #1
0
        public EDsgVar GetExportableDsgVar(DsgMem dsgMem, DsgVar dsgVar, int infoIndex)
        {
            DsgVarInfoEntry infoEntry = dsgVar.dsgVarInfos[infoIndex];
            EDsgVar         d         = new EDsgVar();

            d.type = infoEntry.type;

            if (dsgMem.values == null || dsgMem.values[infoIndex] == null)
            {
                return(d);
            }
            DsgVarValue val = dsgMem.values[infoIndex];

            d.value = GetExportableDsgVarValueString(val);

            return(d);
        }
Example #2
0
        public EDsgVar GetExportableDsgVar(DsgVarInfoEntry infoEntry)
        {
            EDsgVar d = new EDsgVar();

            d.type = infoEntry.type;

            if (infoEntry.value == null)
            {
                return(d);
            }

            switch (infoEntry.type)
            {
            default:
                d.value = infoEntry.value;
                break;

            case DsgVarInfoEntry.DsgVarType.None:
                break;

            case DsgVarInfoEntry.DsgVarType.List:     // TODO: figure out lists
                break;

            case DsgVarInfoEntry.DsgVarType.Comport:     // TODO: comport
                break;

            case DsgVarInfoEntry.DsgVarType.Action:     // TODO: action
                break;

            case DsgVarInfoEntry.DsgVarType.Input:     // TODO: check if this works
                //d.value = infoEntry.value
                break;

            case DsgVarInfoEntry.DsgVarType.SoundEvent:     // TODO: check
                break;

            case DsgVarInfoEntry.DsgVarType.Light:     // TODO: check
                break;

            case DsgVarInfoEntry.DsgVarType.GameMaterial:
                d.value = HashUtils.MD5Hash(GameMaterial.FromOffset((Pointer)(infoEntry.value)).ToJSON());
                break;

            case DsgVarInfoEntry.DsgVarType.VisualMaterial:
                d.value = HashUtils.MD5Hash(VisualMaterial.FromOffset((Pointer)(infoEntry.value)).ToJSON());
                break;

            case DsgVarInfoEntry.DsgVarType.Perso:
                d.value = Perso.FromOffset((Pointer)(infoEntry.value))?.namePerso;
                break;

            case DsgVarInfoEntry.DsgVarType.Waypoint:     // TODO
                d.value = ((Pointer)infoEntry.value).ToString();
                break;

            case DsgVarInfoEntry.DsgVarType.Graph:     // TODO
                d.value = ((Pointer)infoEntry.value).ToString();
                break;

            case DsgVarInfoEntry.DsgVarType.Text:     // TODO: check
                goto default;

            case DsgVarInfoEntry.DsgVarType.SuperObject:     // TODO: check
                break;

            case DsgVarInfoEntry.DsgVarType.SOLinks:     // TODO
                break;

            case DsgVarInfoEntry.DsgVarType.PersoArray:

                List <string> persoNames = new List <string>();
                foreach (object persoPointer in (object[])infoEntry.value)
                {
                    if (persoPointer == null)
                    {
                        continue;
                    }

                    if (!(persoPointer is Pointer))
                    {
                        persoNames.Add("Not a valid pointer: " + (persoPointer).ToString());     // TODO: fix
                        continue;
                    }

                    Perso perso = Perso.FromOffset((Pointer)persoPointer);
                    if (perso != null)
                    {
                        persoNames.Add(perso.namePerso);
                    }
                    else
                    {
                        persoNames.Add("NullPointer");
                    }
                }

                break;

            case DsgVarInfoEntry.DsgVarType.WayPointArray:     // TODO
                break;

            case DsgVarInfoEntry.DsgVarType.TextArray:     // TODO: check
                goto default;

            //break;
            case DsgVarInfoEntry.DsgVarType.TextRefArray:     // TODO: check
                goto default;

            case DsgVarInfoEntry.DsgVarType.Array6:
                break;

            case DsgVarInfoEntry.DsgVarType.Array9:
                break;

            case DsgVarInfoEntry.DsgVarType.SoundEventArray:     // TODO: check
                goto default;

            case DsgVarInfoEntry.DsgVarType.Array11:
                break;

            case DsgVarInfoEntry.DsgVarType.Way:
                break;

            case DsgVarInfoEntry.DsgVarType.ActionArray:     // TODO
                break;

            case DsgVarInfoEntry.DsgVarType.SuperObjectArray:     // TODO
                break;
            }

            return(d);
        }