Exemplo n.º 1
0
        public object GetVerifiableParameters()
        {
            ExportedQuestTask exportedQuestTask = new ExportedQuestTask();

            exportedQuestTask.zone       = Zone.ZoneName;
            exportedQuestTask.threshold  = Threshold;
            exportedQuestTask.comparison = (int)Comparison;
            exportedQuestTask.watchers   = new List <ExportedTaskWatcher>();
            for (int i = 0; i < Watchers.Length; i++)
            {
                TaskWatcher         taskWatcher         = Watchers[i];
                ExportedTaskWatcher exportedTaskWatcher = new ExportedTaskWatcher();
                if (!string.IsNullOrEmpty(taskWatcher.CriteriaSwitchName))
                {
                    GameObject gameObject = GameObject.Find(taskWatcher.CriteriaSwitchName);
                    if (gameObject == null)
                    {
                        Disney.LaunchPadFramework.Log.LogError(this, "Unable to find switch criteria object " + taskWatcher.CriteriaSwitchName + ". Will not be exported");
                        continue;
                    }
                    Switch component = gameObject.GetComponent <Switch>();
                    exportedTaskWatcher.criteriaSwitch = ExportedSwitch.Create(component);
                }
                exportedTaskWatcher.type       = taskWatcher.GetWatcherType();
                exportedTaskWatcher.parameters = taskWatcher.GetExportParameters();
                exportedQuestTask.watchers.Add(exportedTaskWatcher);
            }
            return(exportedQuestTask);
        }
Exemplo n.º 2
0
        public override object GetExportParameters()
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("operator", Operator);
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();

            MultiUserSwitch[] switches = Switches;
            foreach (MultiUserSwitch multiUserSwitch in switches)
            {
                Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                dictionary2.Add("minUserCount", multiUserSwitch.MinUserCount);
                dictionary2.Add("switchDef", ExportedSwitch.Create(GameObject.Find(multiUserSwitch.SwitchName).GetComponent <Switch>()));
                list.Add(dictionary2);
            }
            dictionary.Add("switches", list);
            return(dictionary);
        }
Exemplo n.º 3
0
    private ExportedTaskWatcher exportTaskWatcher(TaskWatcher watcherDef)
    {
        ExportedTaskWatcher exportedTaskWatcher = new ExportedTaskWatcher();

        if (!string.IsNullOrEmpty(watcherDef.CriteriaSwitchName))
        {
            GameObject gameObject = GameObject.Find(watcherDef.CriteriaSwitchName);
            if (gameObject == null)
            {
                Log.LogError(this, "Unable to find switch criteria object " + watcherDef.CriteriaSwitchName + " for WatcherSwitch " + base.name + ". Will not be exported");
                return(null);
            }
            Switch component = gameObject.GetComponent <Switch>();
            exportedTaskWatcher.criteriaSwitch = ExportedSwitch.Create(component);
        }
        exportedTaskWatcher.type       = watcherDef.GetWatcherType();
        exportedTaskWatcher.parameters = watcherDef.GetExportParameters();
        return(exportedTaskWatcher);
    }
    public static ExportedSwitch Create(Switch s)
    {
        ExportedSwitch exportedSwitch = new ExportedSwitch();

        exportedSwitch.type       = s.GetSwitchType();
        exportedSwitch.path       = s.gameObject.GetPath();
        exportedSwitch.latch      = s.Latch;
        exportedSwitch.parameters = s.GetSwitchParameters();
        List <ExportedSwitch> list = new List <ExportedSwitch>();

        for (int i = 0; i < s.transform.childCount; i++)
        {
            Switch component = s.transform.GetChild(i).GetComponent <Switch>();
            if (component != null)
            {
                list.Add(Create(component));
            }
        }
        exportedSwitch.children = list.ToArray();
        return(exportedSwitch);
    }
 public override object GetExportParameters()
 {
     return(ExportedSwitch.Create(GameObject.Find(SwitchName).GetComponent <Switch>()));
 }