示例#1
0
        public static int longProcessMono(ZMaps conf, ZMaps inputs, ZMaps outputs)
        {
            _ZMaps test;
            int    i = 1;

            while (i < 10)
            {
                ZOO_API.UpdateStatus(conf, "Step " + i, (i * 10));
                Thread.Sleep(1000);
                i += 1;
            }
            if (inputs.TryGetValue("a", out test))
            {
                ZMap   content = test.getContent();
                String test1;
                if (content.TryGetValue("value", out test1))
                {
                    outputs.setMapsInMaps("Result", "value", ZOO_API.Translate("Hello ") + test1 + " from the Mono .NET framework World!");
                }
                return(ZOO_API.SERVICE_SUCCEEDED);
            }
            else
            {
                conf.setMapsInMaps("lenv", "message", "Unable to run the service");
                return(ZOO_API.SERVICE_FAILED);
            }
        }
示例#2
0
        private ZMapRotation BuildMapRotation(ZGame game, IDictionary <string, string> attributes)
        {
            var rotation = new ZMapRotation(null);

            // parse available map list
            var mapList = _ParseMapList(attributes["maps"], game);

            // get current and next maps
            var mapRotationIndexes = _ParseMapIndexes(attributes.ContainsKey("mapsinfo") ? attributes["mapsinfo"] : string.Empty);
            var currentMap         = new ZMap
            {
                Name = attributes.ContainsKey("level")
                    ? _mapConverter.GetMapNameByKey(game, attributes["level"])
                    : ZStringConstants.NotAvailable,
                GameModeName = attributes.ContainsKey("levellocation")
                    ? _gameModeConverter.GetGameModeNameByKey(game, attributes["levellocation"])
                    : ZStringConstants.NotAvailable,
                Role = ZMapRole.Current
            };

            rotation.Current = currentMap;

            // check if we can get access to next map in maps list rotation
            if (mapRotationIndexes != null)
            {
                var nextMapIndex = mapRotationIndexes.Last();
                if (nextMapIndex <= mapList.Count - 1)
                {
                    var nextMap = mapList[nextMapIndex];

                    nextMap.Role  = ZMapRole.Next;
                    rotation.Next = nextMap;
                }
            }

            // check if we can get access to current map in maps list rotation
            var map = mapList.FirstOrDefault(
                m => m.Name == currentMap.Name && m.GameModeName == currentMap.GameModeName);

            if (map == null)
            {
                mapList.Add(currentMap);
            }
            else
            {
                map.Role = ZMapRole.Current;
            }

            rotation.Rotation = new ObservableCollection <ZMap>(mapList);

            // remove used keys
            attributes.Remove("maps");
            attributes.Remove("mapsinfo");
            attributes.Remove("level");
            attributes.Remove("levellocation");

            return(rotation);
        }
示例#3
0
        public static int HelloMono(ZMaps conf, ZMaps inputs, ZMaps outputs)
        {
            _ZMaps test;

            if (inputs.TryGetValue("a", out test))
            {
                ZMap   content = test.getContent();
                String test1;
                if (content.TryGetValue("value", out test1))
                {
                    outputs.setMapsInMaps("Result", "value", ZOO_API.Translate("Hello ") + test1 + " from the Mono .NET framework World!");
                }
                return(ZOO_API.SERVICE_SUCCEEDED);
            }
            else
            {
                conf.setMapsInMaps("lenv", "message", "Unable to run the service");
                return(ZOO_API.SERVICE_FAILED);
            }
        }
示例#4
0
 public ZMap GetZMap()
 => ZMap.Parse(WZ.Resolve("Base"));