/// <summary>
        /// Get the available levels.
        /// </summary>
        /// <returns>An array of level information.</returns>
        public override LevelInfo[] GetLevels()
        {
            var levels = new List<LevelInfo>();

            using (DbConnection connection = this.CreateConnection())
            {
                connection.Open();

                using (DbCommand command = ESCommand.GetLevelInfo(connection))
                {
                    using (DbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var level = new LevelInfo(
                                Convert.ToInt32(reader["Number"]),
                                Convert.ToString(reader["Name"]),
                                Convert.ToString(reader["Description"]));

                            levels.Add(level);
                        }
                    }
                }
            }

            return levels.ToArray();
        }
        protected override void InitSimulation(int seed, LevelInfo level, PlayerInfo[] players, Slot[] slots)
        {
            simulation = new SecureSimulation(extensionPaths);

            // Settings aufbauen
            Setup settings = new Setup();
            settings.Seed = seed;
            settings.Level = level.Type;
            settings.Player = new TypeInfo[AntMe.Level.MAX_SLOTS];
            settings.Colors = new PlayerColor[AntMe.Level.MAX_SLOTS];

            for (int i = 0; i < AntMe.Level.MAX_SLOTS; i++)
            {
                // Farben übertragen
                settings.Colors[i] = slots[i].ColorKey;

                // KIs einladen
                if (players[i] != null)
                {
                    settings.Player[i] = players[i].Type;
                }
            }

            simulation.Start(settings);
        }
    // Use this for initialization
    void Start()
    {
        Hashtable sceneArguments = SceneManager.sceneArguments;

        if (sceneArguments != null)
        {
            mLevelId = (int)sceneArguments[Extras.LEVEL_ID_EXTRA];
        }

        mLevelFileName = mLevelId.ToString();

        while (mLevelFileName.Length < 4)
        {
            mLevelFileName = '0' + mLevelFileName;
        }

        mLevelFileName = "Level " + mLevelFileName + ".xml";

#if EDIT_SCENE_LEVEL_DEBUG
        Debug.Log("Loading level : " + mLevelFileName);
#endif

#if UNITY_EDITOR
        mLevelInfo = LevelInfo.load(Application.dataPath + "/Resources/Levels/" + mLevelFileName);
#else
#endif

        // Applying loaded level
        nameEdit.text                     = mLevelInfo.name;
        imageSelectorScript.selectedImage = mLevelInfo.background;
        rowsScrollbar.value               = (float)mLevelInfo.rows    / Global.LEVEL_MAX_HEIGHT;
        columnsScrollbar.value            = (float)mLevelInfo.columns / Global.LEVEL_MAX_WIDTH;
    }
Esempio n. 4
0
	void UpdateList()
	{
		if( info == null ) info = new LevelInfo();
		if( info.partituras == null ) info.partituras = new Partitura[lenght];
	
		info.partituras = new Partitura[lenght];
	}
Esempio n. 5
0
    void Start()
    {
        levelInfo = GameManager.instance.levelInfo;

        enemies = new List<GameObject>();

        SpawnEnemies();
    }
Esempio n. 6
0
 public LevelThumbnail CreateThumbnail(LevelInfo _info)
 {
     GameObject _thumb = Instantiate(Resources.Load("Tools/Thumb")) as GameObject;
     LevelThumbnail _lvl = _thumb.AddComponent<LevelThumbnail>();
     _thumb.transform.parent = ThumbGO.transform;
     _lvl.Setup(_info.LvlName, _info.locked);
     _thumb.gameObject.transform.localPosition = new Vector3(0f,0f, 0f);
     return _lvl;
 }
Esempio n. 7
0
    // Use this for initialization
    void Awake()
    {
        var obj = GameObject.FindGameObjectWithTag("Space");
        if(obj == null)
        {
            obj = GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Core/Space"));
        }

        CurrentLevel = LevelInformation;
    }
Esempio n. 8
0
		public static void SaveLevel(LevelInfo level)
		{
			if (!Directory.Exists(_basePath))
				Directory.CreateDirectory(_basePath);

			NbtFile file = new NbtFile();
			NbtTag dataTag = file.RootTag["Data"] = new NbtCompound("Data");
			level.SaveToNbt(dataTag);
			file.SaveToFile(Path.Combine(_basePath, "level.dat"), NbtCompression.ZLib);
		}
Esempio n. 9
0
 public LevelInfo GetLevelInfo(string levelName)
 {
     var levelInfo = Levels.FirstOrDefault(x => x.Name == levelName);
     if (levelInfo == null)
     {
         levelInfo = new LevelInfo {Name = levelName};
         Levels.Add(levelInfo);
     }
     return levelInfo;
 }
Esempio n. 10
0
    public void resetLevel(bool GameEnd = false)
    {
        Debug.Log("hello...");
         _switchForBeforeNextLevel();

        resetStat(GameEnd);

        curLevel = levelList[index] ;
        _initLevel();
    }
        /// <summary>
        /// Log that an operation has started executing.
        /// </summary>
        /// <param name="operation">The executing operation</param>
        public void OperationStarted(IOperation operation)
        {
            Verify.NotNull(operation, nameof(operation));

            PrepareForChildItem();

            _writer.Write(operation.GetType().Name);

            var levelInfo = new LevelInfo();
            _levelInfo.Push(levelInfo);
        }
Esempio n. 12
0
        public LevelBackground(LevelInfo levelInfo, ContentManager content)
        {
            asset = levelInfo.BackgroundAssetName;
            Fractions = levelInfo.BackgroundFractions;
            path = "Levels/" + levelInfo.Name;

            Backgrounds = new Texture2D[Fractions / 2, 2];
            edgeTexture = new Texture2D(ResolutionManager.graphicsDevice.GraphicsDevice, 1, 1);
            edgeTexture.SetData(new[] { Color.Yellow });

            LoadMap(content);
        }
        protected override void InitSimulation(int seed, LevelInfo level, PlayerInfo[] players, Slot[] slots)
        {
            Assembly levelAssembly = Assembly.Load(level.Type.AssemblyFile);
            Type levelType = levelAssembly.GetType(level.Type.TypeName);

            SimulationContext context = new SimulationContext(
                ExtensionLoader.DefaultTypeResolver,
                ExtensionLoader.ExtensionSettings);

            simulation = Activator.CreateInstance(levelType, context) as Level;

            // Player erzeugen
            LevelSlot[] levelSlots = new LevelSlot[AntMe.Level.MAX_SLOTS];
            for (int i = 0; i < AntMe.Level.MAX_SLOTS; i++)
            {
                // Skipp, falls nicht vorhanden
                if (players[i] == null)
                    continue;

                Assembly playerAssembly = Assembly.Load(players[i].Type.AssemblyFile);
                Type factoryType = playerAssembly.GetType(players[i].Type.TypeName);

                // Identify Name
                var playerAttributes = factoryType.GetCustomAttributes(typeof(FactoryAttribute), true);
                if (playerAttributes.Length != 1)
                    throw new Exception("Player does not have the right number of Player Attributes");

                FactoryAttribute playerAttribute = playerAttributes[0] as FactoryAttribute;

                // Find the right Mapping
                var mappingAttributes = playerAttribute.GetType().
                    GetCustomAttributes(typeof(FactoryAttributeMappingAttribute), false);
                if (mappingAttributes.Length != 1)
                    throw new Exception("Player Attribute has no valid Property Mapping Attribute");

                FactoryAttributeMappingAttribute mappingAttribute = mappingAttributes[0] as FactoryAttributeMappingAttribute;

                // Werte auslesen
                string name = playerAttribute.GetType().GetProperty(mappingAttribute.NameProperty).
                    GetValue(playerAttribute, null) as string;

                levelSlots[i] = new LevelSlot()
                {
                    FactoryType = factoryType,
                    Name = name,
                    Color = slots[i].ColorKey,
                    Team = slots[i].Team
                };
            }

            // Level initialisieren
            simulation.Init(seed, levelSlots);
        }
Esempio n. 14
0
    public void nextLevel(bool GameEnd = false)
    {
        Debug.Log("okay...");
         _switchForBeforeNextLevel();

        resetStat(GameEnd);

        if (index < levelList.Count-1)
            ++index;
        else
            index = 0;

        curLevel = levelList[index] ;
        _initLevel();
    }
	protected void PopulateLevels()
	{
		if (levelXmlDoc == null)
			return;
		
		XmlNodeList levelNodes = levelXmlDoc.SelectNodes("/levels/level");
		levels = new List<LevelInfo>();
		
		//Pull all of the level information from the XML file.
		foreach (XmlNode levelNode in levelNodes)
		{
			int num = 0;
			string title = "", description = "", imageName = "", sceneName = "";
			
			if (levelNode.Attributes["num"] != null)
				int.TryParse(levelNode.Attributes["num"].Value, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture, out num);
			
			if (levelNode.SelectSingleNode("./title") != null)
				title = levelNode.SelectSingleNode("./title").InnerText;
			
			if (levelNode.SelectSingleNode("./description") != null)
				description = levelNode.SelectSingleNode("./description").InnerText;
			
			if (levelNode.SelectSingleNode("./imageName") != null)
				imageName = levelNode.SelectSingleNode("./imageName").InnerText;
			
			if (levelNode.SelectSingleNode("./scene") != null)
				sceneName = levelNode.SelectSingleNode("./scene").InnerText;
			
			LevelInfo info = new LevelInfo();
			info.num = num;
			info.title = title;
			info.description = description;
			info.imageName = imageName;		
			info.sceneName = sceneName;
			
			levels.Add(info);
		}		
		
		//Just to be safe, sort them by level number
		levels.Sort(CompareLevelNums);
		
		//Now run through them all and populate the list panel with each level.
		foreach (LevelInfo levelInfo in levels)
		{
			AddLevelToList(levelInfo);		
		}
	}
Esempio n. 16
0
 public IEnumerator GardenComplete()
 {
     // let the sound effect for planting finish
     yield return new WaitForSeconds(.5f);
     gardenDriver.SendMessage("GardenComplete");
     IsGardenComplete = true;
     AudioSource.PlayClipAtPoint(gardenComplete, Camera.main.transform.position);
     yield return new WaitForSeconds(gardenCompleteDuration);
     currentLevel.isComplete = true;
     currentLevel = null;
     if(IsAllComplete()) {
         Application.LoadLevel("Finish");
     } else {
         Application.LoadLevel("StageSelect");
     }
 }
	public void SetDevice( PlayerDevice device )
	{
		this.device = device;
		unitstats = gameObject.GetComponent<UnitStats>();
		movement = gameObject.GetComponent<Movement>();
		skeletonAnimation = gameObject.GetComponentInChildren<SkeletonAnimation>();
		skeletonAnimation.state.Event += Event;
		skeletonAnimation.UpdateBones += UpdateBones;
		skeletonAnimation.state.End += End;
		head = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("head");
		hip = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("body");
		weaponmanager = gameObject.GetComponentInChildren<WeaponManager>();
		meleemanager = gameObject.GetComponentInChildren<MeleeManager>(); 
		GameObject gameGameObject = GameObject.FindGameObjectWithTag( "Level" );
		level = gameGameObject.GetComponent<LevelInfo>(); 
	}
Esempio n. 18
0
    public void Show(SerializedLevel level)
    {
        CurrentLevel = level;
        CurrentLevelInfo = Player.Instance.GetLevelInfo(level.Name);

        if (CurrentLevelInfo.IsCompleted)
        {
            var numberOfStars = CurrentLevel.NumberOfStarForScore(CurrentLevelInfo.BestScore);

            if (numberOfStars >= 1)
            {
                FirstStar.Show(true);
                if (numberOfStars == 1)
                {
                    StarTarget.text = LocalizationStrings.GetString(Star2TargetString, CurrentLevel.Star2Score);
                }
            }

            if (numberOfStars >= 2)
            {
                SecondStar.Show(true);
                if (numberOfStars == 2)
                {
                    StarTarget.text = LocalizationStrings.GetString(Star3TargetString, CurrentLevel.Star3Score);
                }
            }

            if (numberOfStars >= 3)
            {
                ThirdStar.Show(true);
                if (numberOfStars == 3)
                {
                    StarTarget.text = string.Empty;
                }
            }
        }
        else
        {
            FirstStar.Show(false);
            SecondStar.Show(false);
            ThirdStar.Show(false);

            StarTarget.text = LocalizationStrings.GetString(Star1TargetString, CurrentLevel.Star1Score);
        }

        Show();
    }
Esempio n. 19
0
    public LevelInfo[] LoadLevels()
    {
        List<LevelInfo> loadedLevels = new List<LevelInfo>();

        XmlDocument document = new XmlDocument();
        document.Load(_fileName);

        foreach (XmlNode node in document.DocumentElement.ChildNodes)
        {
            LevelInfo levelInfo = new LevelInfo();
            levelInfo.answer = node.Attributes["answer"].InnerText;
            levelInfo.image = node.Attributes["image"].InnerText;
            loadedLevels.Add(levelInfo);
        }

        return loadedLevels.ToArray();
    }
Esempio n. 20
0
        public void SetLevel(LevelInfo level)
        {
            this.level = level;

            if (level != null)
            {
                nameLabel.Text = level.LevelDescription.Name;
                descriptionLabel.Text = level.LevelDescription.Description;
                mapPreview1.SetMap(level.Map);
            }
            else
            {
                nameLabel.Text = string.Empty;
                descriptionLabel.Text = string.Empty;
                mapPreview1.SetMap(null);
            }
        }
Esempio n. 21
0
    public void Show(int numberOfTurnsLeft, int score, int bestScore, LevelInfo levelInfo, SerializedLevel level)
    {
        TempScore = 0;
        TargetScore = score;

        LevelInfo = levelInfo;
        Level = level;

        TurnsLeft.text = LocalizationStrings.GetString(TurnsLeftString, numberOfTurnsLeft);
        Score.text = LocalizationStrings.GetString(ScoreString, 0);
        BestScore.text = LocalizationStrings.GetString(BestScoreString, bestScore);

        FirstStar.Show(false);
        SecondStar.Show(false);
        ThirdStar.Show(false);

        Show();
    }
Esempio n. 22
0
 public void Setup(GameSetup.LevelList _set, bool _isLocked)
 {
     nameLv = _set;
     Locked = _isLocked;
     if (nameLv != GameSetup.LevelList.None)
     {
         Info = Instantiate(Resources.Load("Tuning/Levels/" +  nameLv.ToString())) as LevelInfo;
     }
     gameObject.name = _set.ToString();
     Locker = FETool.findWithinChildren(gameObject, "Lock").GetComponentInChildren<OTSprite>();
     if (Locked == true)
     {
         Locker.alpha = 1f;
     }
     else
     {
         Locker.alpha = 0f;
     }
     linkedPlayBtn = GetComponentInChildren<MiscButton>();
 }
Esempio n. 23
0
    void Start()
    {
        //Get reference to level info from the game manager
        levelInfo = GameManager.instance.levelInfo;

        characterAction = GetComponent<CharacterAction>();
        characterAnimation = GetComponent<CharacterAnimation>();

        //Get spawn node if player, enemies are set when spawned
        if(isPlayer)
            spawnNode = levelInfo.GetSpawnTile(TileNode.Type.PlayerSpawn);

        //Start character at spawn node
        transform.position = spawnNode.worldPosition;
        //Set array position to spawn node
        MoveToNode(spawnNode.gridPosition);

        //set target position to current
        newPos = transform.position;
    }
Esempio n. 24
0
    public LevelInfo GetInfoForLevel(int wave)
    {
        var toReturn = new LevelInfo();
        toReturn.m_rand = m_rand;
        toReturn.m_level = wave;

        toReturn.m_baseEnemySpawn = GetEnemyBaseSpawn(wave);
        toReturn.m_roundEnemySpawn = GetEnemyRoundSpawn(wave);
        toReturn.m_baseHumanSpawn = GetHumanBaseSpawn(wave);
        toReturn.m_roundHumanSpawn = GetHumanRoundSpawn(wave);

        toReturn.m_gruntChance = GetGruntOdds(wave);
        toReturn.m_robotChance = GetRobotOdds(wave);
        toReturn.m_tankChance = GetTankOdds(wave);
        toReturn.m_spawnerChance = GetSpawnerOdds(wave);
        toReturn.m_exploderChance = GetExploderOdds(wave);

        JustifyOdds(toReturn);

        toReturn.m_mobSpawnRate = toReturn.m_roundEnemySpawn == 0 ? float.MaxValue : 10.0f / toReturn.m_roundEnemySpawn;
        toReturn.m_humanSpawnRate = toReturn.m_roundHumanSpawn == 0 ? float.MaxValue : 10.0f / toReturn.m_roundHumanSpawn;

        return toReturn;
    }
Esempio n. 25
0
 public override void Init(LevelInfo level)
 {
     Blocks = new RandomBlockCreator(10, 5, 4).BlocksInfo;
 }
Esempio n. 26
0
            public static LevelInfo GetLevelInfo(string id)
            {
                if (!ResourcableXml(LevelXmlPath, ref levelXmlAsset))
                {
                    return(null);
                }

                XmlDocument xmlDoc = new XmlDocument();

                xmlDoc.LoadXml(levelXmlAsset.text);

                XmlElement xRoot = xmlDoc.DocumentElement;

                LevelInfo inf = new LevelInfo();

                bool    NeedXml       = false;
                XmlNode acceptedxnode = null;

                foreach (XmlNode xnode in xRoot)
                {
                    if (xnode.Attributes.GetNamedItem("lng").Value == GameManager.SelectedLanguage)
                    {
                        acceptedxnode = xnode;
                        break;
                    }
                }

                string recomendedPrefix = "Рекоммендуемый уровень: ";

                if (acceptedxnode != null)
                {
                    foreach (XmlNode xnode in acceptedxnode.ChildNodes)
                    {
                        if (xnode.Name == "recomended")
                        {
                            recomendedPrefix = xnode.ChildNodes[0].InnerText;
                        }

                        if (xnode.Attributes.Count > 0)
                        {
                            XmlNode attr = xnode.Attributes.GetNamedItem("name");
                            if (attr.Value == id)
                            {
                                NeedXml = true;
                            }
                            else
                            {
                                if (NeedXml)
                                {
                                    return(inf);
                                }
                            }
                        }

                        if (NeedXml)
                        {
                            foreach (XmlNode childnode in xnode.ChildNodes)
                            {
                                if (childnode.Name == "name")
                                {
                                    inf.LevelName = childnode.InnerText;
                                }
                                if (childnode.Name == "description")
                                {
                                    inf.LevelDiscription = childnode.InnerText;
                                }
                                if (childnode.Name == "rec")
                                {
                                    inf.RecomendedLevel = recomendedPrefix + childnode.InnerText;
                                }
                            }
                        }
                    }
                }
                return(inf);
            }
Esempio n. 27
0
	public _LevelEditor()
	{
		info = new LevelInfo();
		info.tema = new Tema();
	}
Esempio n. 28
0
        public void Init(World worldReceiver, out LevelInfo info)
        {
            World = worldReceiver;

            Initiate(out info);
        }
Esempio n. 29
0
 public void Activate(LevelInfo level)
 {
     text.text = this.MakeStats(level);
     screen.SetActive(true);
     Time.timeScale = 0;
 }
Esempio n. 30
0
        public static MoveLevelResult Show(LevelService levelService, WorldService worldService, WorldInfo hostWorld, LevelInfo parentLevel)
        {
            MoveLevelResult moveLevelResult = null;

            MoveLevelWindow window = new MoveLevelWindow(levelService, worldService, hostWorld, parentLevel);

            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();


            if (window.DialogResult == true)
            {
                moveLevelResult = new MoveLevelResult();
                if (window.ParentLevel != null)
                {
                    moveLevelResult.InfoNode = window.ParentLevel;
                }
                else
                {
                    moveLevelResult.InfoNode = window.HostWorld;
                }

                return(moveLevelResult);
            }

            return(moveLevelResult);
        }
Esempio n. 31
0
    public float SetupLevels(PackWindow.AnimationState state = PackWindow.AnimationState.ANIMATION_STATE_NONE)
    {
        foreach (Transform item in content.transform)
        {
            item.gameObject.SetActive(value: false);
            UnityEngine.Object.Destroy(item.gameObject);
        }
        Pack pack = ELSingleton <LevelsSettings> .Instance.levelSet.GetPack(levelInfo);

        List <PackLevelItem> list = new List <PackLevelItem>();
        float num  = 0f;
        float num2 = 0f;
        float num3 = 0f;
        int   num4 = -1;

        for (int i = 0; i < pack.levels.Count; i++)
        {
            LevelInfo li = levelInfo;
            li.currentLevel = i;
            PackLevelItem packLevelItem = UnityEngine.Object.Instantiate(packLevelItemPrefab, content.transform);
            packLevelItem.Prepare(li, num3, i);
            if (packLevelItem.IsCompleteAnimation)
            {
                num4 = i;
            }
            RectTransform component = packLevelItem.GetComponent <RectTransform>();
            packLevelItem.transform.localPosition = new Vector2(num - component.sizeDelta.x * 2f, 0f - num2 - component.sizeDelta.y / 2f + 20f);
            num += component.sizeDelta.x;
            if (i % 5 == 4)
            {
                num   = 0f;
                num2 += component.sizeDelta.y;
            }
            num3 += 0.02f;
            if (packLevelItem.IsUnlocked || ELSingleton <ApplicationSettings> .Instance.DeploymentSettings.isCheatsEnabled)
            {
                packLevelItem.OnClick.AddListener(delegate
                {
                    PlayButton(li);
                });
            }
            list.Add(packLevelItem);
        }
        int   num5 = 0;
        float num6 = 0f;

        foreach (PackLevelItem item2 in list)
        {
            if (!item2.IsCompleteAnimation)
            {
                item2.StartAnimation(num6, old: false);
            }
            num6 += 0.02f;
            num5++;
        }
        num5 = 0;
        num6 = 0.5f;
        foreach (PackLevelItem item3 in list)
        {
            bool  flag = num4 - num5 >= 5;
            float num7 = flag ? 0.1f : 0.5f;
            if (flag)
            {
                item3.particle = null;
            }
            if (item3.IsCompleteAnimation)
            {
                item3.StartAnimation(num6, flag);
                num6 += num7;
                item3.transform.SetAsLastSibling();
            }
            if (item3.IsCurrent)
            {
                item3.StartPlayTransform(num6);
            }
            num5++;
        }
        pack.progressIndex = Mathf.Max(num4 + 1, pack.progressIndex);
        ELSingleton <LevelsSettings> .Instance.Save();

        return(num6);
    }
Esempio n. 32
0
 private void OnTriggerStay(Collider other)
 {
     if (this.active_me)
     {
         if (!this.currentHitsII.Contains(other.gameObject))
         {
             this.currentHitsII.Add(other.gameObject);
             this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().startShake(0.1f, 0.1f, 0.95f);
             if (other.gameObject.transform.root.gameObject.tag == "titan")
             {
                 GameObject obj2;
                 this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <HERO>().slashHit.Play();
                 if (IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.SINGLE)
                 {
                     obj2 = PhotonNetwork.Instantiate("hitMeat", base.transform.position, Quaternion.Euler(270f, 0f, 0f), 0);
                 }
                 else
                 {
                     obj2 = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("hitMeat"));
                 }
                 obj2.transform.position = base.transform.position;
                 base.transform.root.GetComponent <HERO>().useBlade(0);
             }
         }
         if (other.gameObject.tag == "playerHitbox")
         {
             if (LevelInfo.getInfo(FengGameManagerMKII.level).pvp)
             {
                 float b = 1f - (Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f);
                 b = Mathf.Min(1f, b);
                 HitBox component = other.gameObject.GetComponent <HitBox>();
                 if ((((component != null) && (component.transform.root != null)) && (component.transform.root.GetComponent <HERO>().myTeam != this.myTeam)) && !component.transform.root.GetComponent <HERO>().isInvincible())
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!component.transform.root.GetComponent <HERO>().isGrabbed)
                         {
                             Vector3 vector = component.transform.root.transform.position - base.transform.position;
                             component.transform.root.GetComponent <HERO>().die((Vector3)(((vector.normalized * b) * 1000f) + (Vector3.up * 50f)), false);
                         }
                     }
                     else if (((IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.MULTIPLAYER) && !component.transform.root.GetComponent <HERO>().HasDied()) && !component.transform.root.GetComponent <HERO>().isGrabbed)
                     {
                         component.transform.root.GetComponent <HERO>().markDie();
                         object[] parameters = new object[5];
                         Vector3  vector2    = component.transform.root.position - base.transform.position;
                         parameters[0] = (Vector3)(((vector2.normalized * b) * 1000f) + (Vector3.up * 50f));
                         parameters[1] = false;
                         parameters[2] = base.transform.root.gameObject.GetPhotonView().viewID;
                         parameters[3] = PhotonView.Find(base.transform.root.gameObject.GetPhotonView().viewID).owner.CustomProperties[PhotonPlayerProperty.name];
                         parameters[4] = false;
                         component.transform.root.GetComponent <HERO>().photonView.RPC("netDie", PhotonTargets.All, parameters);
                     }
                 }
             }
         }
         else if (other.gameObject.tag == "titanneck")
         {
             HitBox item = other.gameObject.GetComponent <HitBox>();
             if (((item != null) && this.checkIfBehind(item.transform.root.gameObject)) && !this.currentHits.Contains(item))
             {
                 item.hitPosition = (Vector3)((base.transform.position + item.transform.position) * 0.5f);
                 this.currentHits.Add(item);
                 this.meatDie.Play();
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if ((item.transform.root.GetComponent <TITAN>() != null) && !item.transform.root.GetComponent <TITAN>().hasDie)
                     {
                         Vector3 vector3 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                         int     num2    = (int)((vector3.magnitude * 10f) * this.scoreMulti);
                         num2 = Mathf.Max(10, num2);
                         if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                         {
                             GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>().startSnapShot2(item.transform.position, num2, item.transform.root.gameObject, 0.02f);
                         }
                         item.transform.root.GetComponent <TITAN>().die();
                         this.napeMeat(this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity, item.transform.root);
                         GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().netShowDamage(num2);
                         GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().playerKillInfoSingleUpdate(num2);
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (item.transform.root.GetComponent <TITAN>() != null)
                     {
                         if (!item.transform.root.GetComponent <TITAN>().hasDie)
                         {
                             Vector3 vector4 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                             int     num3    = (int)((vector4.magnitude * 10f) * this.scoreMulti);
                             num3 = Mathf.Max(10, num3);
                             if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                             {
                                 GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>().startSnapShot2(item.transform.position, num3, item.transform.root.gameObject, 0.02f);
                                 item.transform.root.GetComponent <TITAN>().asClientLookTarget = false;
                             }
                             object[] objArray2 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID, num3 };
                             item.transform.root.GetComponent <TITAN>().photonView.RPC("titanGetHit", item.transform.root.GetComponent <TITAN>().photonView.owner, objArray2);
                         }
                     }
                     else if (item.transform.root.GetComponent <FEMALE_TITAN>() != null)
                     {
                         base.transform.root.GetComponent <HERO>().useBlade(0x7fffffff);
                         Vector3 vector5 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                         int     num4    = (int)((vector5.magnitude * 10f) * this.scoreMulti);
                         num4 = Mathf.Max(10, num4);
                         if (!item.transform.root.GetComponent <FEMALE_TITAN>().hasDie)
                         {
                             object[] objArray3 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID, num4 };
                             item.transform.root.GetComponent <FEMALE_TITAN>().photonView.RPC("titanGetHit", item.transform.root.GetComponent <FEMALE_TITAN>().photonView.owner, objArray3);
                         }
                     }
                     else if (item.transform.root.GetComponent <COLOSSAL_TITAN>() != null)
                     {
                         base.transform.root.GetComponent <HERO>().useBlade(0x7fffffff);
                         if (!item.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie)
                         {
                             Vector3 vector6 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                             int     num5    = (int)((vector6.magnitude * 10f) * this.scoreMulti);
                             num5 = Mathf.Max(10, num5);
                             object[] objArray4 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID, num5 };
                             item.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", item.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, objArray4);
                         }
                     }
                 }
                 else if (item.transform.root.GetComponent <TITAN>() != null)
                 {
                     if (!item.transform.root.GetComponent <TITAN>().hasDie)
                     {
                         Vector3 vector7 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                         int     num6    = (int)((vector7.magnitude * 10f) * this.scoreMulti);
                         num6 = Mathf.Max(10, num6);
                         if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                         {
                             GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>().startSnapShot2(item.transform.position, num6, item.transform.root.gameObject, 0.02f);
                         }
                         item.transform.root.GetComponent <TITAN>().titanGetHit(base.transform.root.gameObject.GetPhotonView().viewID, num6);
                     }
                 }
                 else if (item.transform.root.GetComponent <FEMALE_TITAN>() != null)
                 {
                     base.transform.root.GetComponent <HERO>().useBlade(0x7fffffff);
                     if (!item.transform.root.GetComponent <FEMALE_TITAN>().hasDie)
                     {
                         Vector3 vector8 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                         int     num7    = (int)((vector8.magnitude * 10f) * this.scoreMulti);
                         num7 = Mathf.Max(10, num7);
                         if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                         {
                             GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>().startSnapShot2(item.transform.position, num7, null, 0.02f);
                         }
                         item.transform.root.GetComponent <FEMALE_TITAN>().titanGetHit(base.transform.root.gameObject.GetPhotonView().viewID, num7);
                     }
                 }
                 else if (item.transform.root.GetComponent <COLOSSAL_TITAN>() != null)
                 {
                     base.transform.root.GetComponent <HERO>().useBlade(0x7fffffff);
                     if (!item.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie)
                     {
                         Vector3 vector9 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - item.transform.root.GetComponent <Rigidbody>().velocity;
                         int     num8    = (int)((vector9.magnitude * 10f) * this.scoreMulti);
                         num8 = Mathf.Max(10, num8);
                         if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                         {
                             GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>().startSnapShot2(item.transform.position, num8, null, 0.02f);
                         }
                         item.transform.root.GetComponent <COLOSSAL_TITAN>().titanGetHit(base.transform.root.gameObject.GetPhotonView().viewID, num8);
                     }
                 }
                 this.showCriticalHitFX();
             }
         }
         else if (other.gameObject.tag == "titaneye")
         {
             if (!this.currentHits.Contains(other.gameObject))
             {
                 this.currentHits.Add(other.gameObject);
                 GameObject gameObject = other.gameObject.transform.root.gameObject;
                 if (gameObject.GetComponent <FEMALE_TITAN>() != null)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                         {
                             gameObject.GetComponent <FEMALE_TITAN>().hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                         {
                             object[] objArray5 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID };
                             gameObject.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray5);
                         }
                     }
                     else if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                     {
                         gameObject.GetComponent <FEMALE_TITAN>().hitEyeRPC(base.transform.root.gameObject.GetPhotonView().viewID);
                     }
                 }
                 else if (gameObject.GetComponent <TITAN>().abnormalType != AbnormalType.TYPE_CRAWLER)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!gameObject.GetComponent <TITAN>().hasDie)
                         {
                             gameObject.GetComponent <TITAN>().hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!gameObject.GetComponent <TITAN>().hasDie)
                         {
                             object[] objArray6 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID };
                             gameObject.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray6);
                         }
                     }
                     else if (!gameObject.GetComponent <TITAN>().hasDie)
                     {
                         gameObject.GetComponent <TITAN>().hitEyeRPC(base.transform.root.gameObject.GetPhotonView().viewID);
                     }
                     this.showCriticalHitFX();
                 }
             }
         }
         else if ((other.gameObject.tag == "titanankle") && !this.currentHits.Contains(other.gameObject))
         {
             this.currentHits.Add(other.gameObject);
             GameObject obj4     = other.gameObject.transform.root.gameObject;
             Vector3    vector10 = this.currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <Rigidbody>().velocity - obj4.GetComponent <Rigidbody>().velocity;
             int        num9     = (int)((vector10.magnitude * 10f) * this.scoreMulti);
             num9 = Mathf.Max(10, num9);
             if ((obj4.GetComponent <TITAN>() != null) && (obj4.GetComponent <TITAN>().abnormalType != AbnormalType.TYPE_CRAWLER))
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (!obj4.GetComponent <TITAN>().hasDie)
                     {
                         obj4.GetComponent <TITAN>().hitAnkle();
                     }
                 }
                 else
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!obj4.GetComponent <TITAN>().hasDie)
                         {
                             object[] objArray7 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID };
                             obj4.GetComponent <TITAN>().photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, objArray7);
                         }
                     }
                     else if (!obj4.GetComponent <TITAN>().hasDie)
                     {
                         obj4.GetComponent <TITAN>().hitAnkle();
                     }
                     this.showCriticalHitFX();
                 }
             }
             else if (obj4.GetComponent <FEMALE_TITAN>() != null)
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (other.gameObject.name == "ankleR")
                     {
                         if ((obj4.GetComponent <FEMALE_TITAN>() != null) && !obj4.GetComponent <FEMALE_TITAN>().hasDie)
                         {
                             obj4.GetComponent <FEMALE_TITAN>().hitAnkleR(num9);
                         }
                     }
                     else if ((obj4.GetComponent <FEMALE_TITAN>() != null) && !obj4.GetComponent <FEMALE_TITAN>().hasDie)
                     {
                         obj4.GetComponent <FEMALE_TITAN>().hitAnkleL(num9);
                     }
                 }
                 else if (other.gameObject.name == "ankleR")
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!obj4.GetComponent <FEMALE_TITAN>().hasDie)
                         {
                             object[] objArray8 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID, num9 };
                             obj4.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, objArray8);
                         }
                     }
                     else if (!obj4.GetComponent <FEMALE_TITAN>().hasDie)
                     {
                         obj4.GetComponent <FEMALE_TITAN>().hitAnkleRRPC(base.transform.root.gameObject.GetPhotonView().viewID, num9);
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (!obj4.GetComponent <FEMALE_TITAN>().hasDie)
                     {
                         object[] objArray9 = new object[] { base.transform.root.gameObject.GetPhotonView().viewID, num9 };
                         obj4.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, objArray9);
                     }
                 }
                 else if (!obj4.GetComponent <FEMALE_TITAN>().hasDie)
                 {
                     obj4.GetComponent <FEMALE_TITAN>().hitAnkleLRPC(base.transform.root.gameObject.GetPhotonView().viewID, num9);
                 }
                 this.showCriticalHitFX();
             }
         }
     }
 }
Esempio n. 33
0
        public ActionResult MemberUpdateForVIP(Dictionary <string, string> queryvalues)
        {
            int  _type  = queryvalues.ContainsKey("Type") ? Convert.ToInt32(queryvalues["Type"]) : 0;
            int  _id    = queryvalues.ContainsKey("ID") ? Convert.ToInt32(queryvalues["ID"]) : 0;
            int  _level = queryvalues.ContainsKey("Grade") ? Convert.ToInt32(queryvalues["Grade"]) : 0;
            int  _point = queryvalues.ContainsKey("Point") ? Convert.ToInt32(queryvalues["Point"]) : 0;
            Role model  = new Role();

            model = RoleBLL.GetRoleByString(new Role()
            {
                ID = _id
            });
            if (model == null)
            {
                return(View(model));
            }
            model.UpdateProperty = _type;
            //数据修改操作
            if (Request.IsAjaxRequest())
            {
                //没有封号不能修改
                if (model.IsFreeze == isSwitch.开)
                {
                    return(Content("-1"));
                }
                if (_type == 3)     //绑定俱乐部
                {
                    //检查是不是俱乐部,不是俱乐部,不让绑定
                    IEnumerable <ClubInfo> clubs = ClubBLL.GetClubInfo(_level);
                    if (clubs != null && clubs.Count() > 0)
                    {
                    }
                    else
                    {
                        return(Content("4"));//不是俱乐部
                    }


                    Beland_Club_C BelandlubC;
                    // model.Minu 传一个时间长短给服务器
                    BelandlubC = Beland_Club_C.CreateBuilder()
                                 .SetClubID((uint)_level)
                                 .SetDwUserID((uint)_id)
                                 .Build();



                    Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_BELAND_CLUB, BelandlubC.ToByteArray()));


                    switch ((CenterCmd)tbind.header.CommandID)
                    {
                    case CenterCmd.CS_BELAND_CLUB:
                        Beland_Club_S BelandClubS = Beland_Club_S.ParseFrom(tbind.body.ToBytes());
                        bool          res         = BelandClubS.Suc;
                        if (res)
                        {
                            return(Content("5"));
                        }
                        else
                        {
                            return(Content("6"));
                        }

                    case CenterCmd.CS_CONNECT_ERROR:
                        break;
                    }

                    return(Content("6"));



                    //model.ClubID = _level;
                    //int res = RoleBLL.UpdateRoleClub(model);
                    //if(res == 1)    //绑定不是俱乐部ID
                    //{
                    //    return Content("4");
                    //}
                    //else
                    //{
                    //    return Content(res.ToString());
                    //}
                }
                //玩家数据为空
                if (model.ExtInfo == null)
                {
                    return(Content("-2"));
                }
                else
                {
                    /////////////////////////////////////////////////////////////////////////////////

                    if (SystemType == "2")//万人德州
                    {
                        BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo);
                        if (_type == 1)  //修改VIP等级
                        {
                            VipInfo VipInfo22;

                            VipInfo22 = VipInfo.CreateBuilder(BExtInfo.VipInfo)
                                        .SetGrade((int)_level)
                                        .SetCurrent((int)_point)
                                        .Build();


                            BExtInfo = BExtInfo.CreateBuilder(BExtInfo)
                                       .SetVipInfo(VipInfo22)
                                       .Build();
                        }
                        else if (_type == 2) //修改等级
                        {
                            LevelInfo LevelInfo22;

                            LevelInfo22 = LevelInfo.CreateBuilder(BExtInfo.LevelInfo)
                                          .SetLevel(_level)
                                          .SetExp(_point)
                                          .Build();


                            BExtInfo = BExtInfo.CreateBuilder(BExtInfo)
                                       .SetLevelInfo(LevelInfo22)
                                       .Build();
                        }
                        byte[] bs = BExtInfo.ToByteArray();
                        model.ExtInfo = bs;
                        return(Content(RoleBLL.UpdateRole(model).ToString()));
                    }
                    else if (SystemType == "1")
                    {
                        byte[] Data = new byte[4];
                        Array.Copy(model.ExtInfo, 4, Data, 0, 4);
                        int    num   = System.BitConverter.ToInt32(Data, 0);
                        byte[] Grade = System.BitConverter.GetBytes(_level);
                        byte[] Point = System.BitConverter.GetBytes(_point);
                        for (int j = 0; j < 4; j++)
                        {
                            if (_type == 1)  //修改VIP等级
                            {
                                model.ExtInfo[16 + j] = Grade[j];
                                model.ExtInfo[20 + j] = Point[j];
                            }
                            else if (_type == 2) //修改等级
                            {
                                model.ExtInfo[36 + j] = Grade[j];
                                model.ExtInfo[40 + j] = Point[j];
                            }
                        }
                        return(Content(RoleBLL.UpdateRole(model).ToString()));
                    }
                    else
                    {
                    }
                }
            }
            //数据查询操作
            if (model.ExtInfo == null)
            {
                return(View(model));
            }
            else
            {
                if (SystemType == "2")
                {
                    BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo);
                    model.VipGrade   = BExtInfo.VipInfo.Grade;   //VIP等级
                    model.VipPoint   = BExtInfo.VipInfo.Current; //VIP等级
                    model.LevelGrade = BExtInfo.LevelInfo.Level; //玩家等级
                    model.LevelPoint = BExtInfo.LevelInfo.Exp;   //玩家等级
                    return(View(model));
                }
                else
                {
                    int    indexData = 4;
                    byte[] numData   = new byte[4];
                    Array.Copy(model.ExtInfo, indexData, numData, 0, 4);
                    int num = System.BitConverter.ToInt32(numData, 0);
                    indexData = indexData + 4;

                    byte[] DataInfo = new byte[num];
                    Array.Copy(model.ExtInfo, 0, DataInfo, 0, num);
                    while (indexData < num)
                    {
                        //类型ID
                        int typeid = System.BitConverter.ToInt32(DataInfo, indexData);
                        indexData = indexData + 4;
                        //数据长度
                        int datanum = System.BitConverter.ToInt32(DataInfo, indexData);
                        indexData = indexData + 4;
                        //VIP等级
                        if (typeid == 1)
                        {
                            model.VipGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                            model.VipPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                            indexData      = indexData + datanum;
                        }
                        //玩家等级
                        else if (typeid == 2)
                        {
                            model.LevelGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                            model.LevelPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                            indexData        = indexData + datanum;
                        }
                        else
                        {
                            indexData = indexData + datanum;
                        }
                    }
                    return(View(model));
                }
            }
        }
Esempio n. 34
0
    void Start()
    {
        if(instance != null) {
            Destroy(gameObject);
            return;
        }
        instance = this;
        DontDestroyOnLoad(gameObject);

        if(currentLevel == null) {
            currentLevel = GameConfig.instance.levels[0];
        }
        InitLevel();
    }
Esempio n. 35
0
    public void OnStart(LevelInfo data) //Initializing method called from the UIMnager at the level start
    {
        isMovingAimType = DataManager.Instance.isMovingAimType;
        gridSize        = DataManager.Instance.gridSize;

        //Initialize data
        taskImage = GetComponent <Image>();
        BoxCollider2D boundsBox = GetComponent <BoxCollider2D>();
        float         sideX     = boundsBox.size.x; //Image size in a local space
        float         sideY     = boundsBox.size.y;

        leftBounds  = boundsBox.transform.TransformPoint(new Vector3(-sideX / 2, -sideY / 2));                              //Left and bottom sides of the image square
        rightBounds = boundsBox.transform.TransformPoint(new Vector3(sideX / 2, sideY / 2)) - new Vector3(0.20f, 0.20f, 0); //Right and upper sides of the image square

        if (LettersBoard.ratio2)                                                                                            // Is 18:9(IphoneX) ratio?
        {
            leftBounds  += new Vector2(0.20f, 0.20f);                                                                       //Cause main canvas resolution scaled, bounds sides are needed to be decreased
            rightBounds -= new Vector2(0.20f, 0.20f);
        }
        //Configure particles
        var main = puffPrefab.GetComponent <ParticleSystem>().main;

        main.startColor = UIManager.levelColor;

        //Set up planks grid
        GridLayoutGroup grid = GetComponent <GridLayoutGroup>();

        grid.cellSize = new Vector2(sideX / gridSize, sideY / gridSize);

        for (int i = 0; i < Mathf.Pow(gridSize, 2); i++)
        {
            int x = i;

            //Instantiate, configure and add to collection each plank
            GameObject tempplank = Instantiate(plankPrefab, taskImage.transform);
            tempplank.AddComponent <BoxCollider2D>().size = grid.cellSize + new Vector2(5f, 5f);
            planks.Add(tempplank);
            Button tempBut = planks[x].GetComponent <Button>();
            tempBut.onClick.AddListener(() => HitPlank(x));

            if (isMovingAimType)
            {
                if (DataManager.Instance.RemoveClearButtons)
                {
                    tempplank.GetComponent <Image>().raycastTarget = false;
                }
                tempBut.interactable = false;
            }
        }

        if (data.openedPlanks != null) //Set up planks that are already opened earlier
        {
            foreach (var item in data.openedPlanks)
            {
                planks[item].GetComponent <Image>().enabled = false;
            }
            planksOppened.AddRange(data.openedPlanks);
        }

        if (isMovingAimType)                             //Configure hint button
        {
            if (DataManager.Instance.RemoveClearButtons) //Force task image to be a hint button
            {
                taskImage.raycastTarget = true;
                Button newBut = taskImage.gameObject.AddComponent <Button>();
                newBut.transition = Selectable.Transition.None;
                aimButton         = newBut;
            }
            else
            {
                aimButton.image.sprite = buttonSprite;
                aimButton.GetComponent <RectTransform>().sizeDelta += new Vector2(50, 50);
            }

            aimButton.onClick.RemoveAllListeners();
            aimButton.onClick.AddListener(HandleAimButton);
        }
    }
Esempio n. 36
0
 public static void UpdateLevel(LevelInfo currentLevel)
 {
     database.UpdateLevel(currentLevel);
 }
Esempio n. 37
0
        public override void Use(Player p, string message)
        {
            if (Player.IsSuper(p))
            {
                MessageInGameOnly(p); return;
            }
            string[] args = message.ToLower().Split(' ');
            string   cmd  = args[0];

            if (cmd == "")
            {
                Help(p); return;
            }

            if (args.Length == 1 && cmd == "list")
            {
                Player.Message(p, "Waypoints:");
                foreach (Warp wp in p.Waypoints.Items)
                {
                    if (LevelInfo.FindExact(wp.lvlname) != null)
                    {
                        Player.Message(p, wp.name + " : " + wp.lvlname);
                    }
                }
                return;
            }
            else if (args.Length == 1)
            {
                if (!p.Waypoints.Exists(cmd))
                {
                    Player.Message(p, "That waypoint does not exist"); return;
                }
                p.Waypoints.Goto(cmd, p);
                return;
            }

            string name = args[1];

            if (cmd == "create" || cmd == "new" || cmd == "add")
            {
                if (p.Waypoints.Exists(name))
                {
                    Player.Message(p, "That waypoint already exists"); return;
                }
                p.Waypoints.Create(name, p);
                Player.Message(p, "Created waypoint");
            }
            else if (cmd == "goto")
            {
                if (!p.Waypoints.Exists(name))
                {
                    Player.Message(p, "That waypoint does not exist"); return;
                }
                p.Waypoints.Goto(name, p);
            }
            else if (cmd == "replace" || cmd == "update" || cmd == "edit")
            {
                if (!p.Waypoints.Exists(name))
                {
                    Player.Message(p, "That waypoint does not exist"); return;
                }
                p.Waypoints.Update(name, p);
                Player.Message(p, "Updated waypoint");
            }
            else if (cmd == "delete" || cmd == "remove")
            {
                if (!p.Waypoints.Exists(name))
                {
                    Player.Message(p, "That waypoint does not exist"); return;
                }
                p.Waypoints.Remove(name, p);
                Player.Message(p, "Deleted waypoint");
            }
            else
            {
                Help(p);
            }
        }
        static void HandleMap(Player p, string cmd, string value)
        {
            cmd = cmd.ToUpper();
            bool mapOnly = !(cmd.Length == 0 || IsCreateCommand(cmd));

            if (mapOnly && !LevelInfo.IsRealmOwner(p.name, p.level.name))
            {
                p.Message("You may only perform that action on your own map."); return;
            }

            if (IsCreateCommand(cmd))
            {
                AddMap(p, value);
            }
            else if (cmd == "PHYSICS")
            {
                if (value == "0" || value == "1" || value == "2" || value == "3" || value == "4" || value == "5")
                {
                    CmdPhysics.SetPhysics(p.level, int.Parse(value));
                }
                else
                {
                    p.Message("Accepted numbers are: 0, 1, 2, 3, 4 or 5");
                }
            }
            else if (IsDeleteCommand(cmd))
            {
                DeleteMap(p, value);
            }
            else if (cmd == "SAVE")
            {
                UseCommand(p, "Save", "");
            }
            else if (cmd == "RESTORE")
            {
                UseCommand(p, "Restore", value);
            }
            else if (cmd == "RESIZE")
            {
                value = p.level.name + " " + value;
                string[] args = value.SplitSpaces();
                if (args.Length < 4)
                {
                    Command.Find("ResizeLvl").Help(p); return;
                }

                bool needConfirm;
                if (CmdResizeLvl.DoResize(p, args, p.DefaultCmdData, out needConfirm))
                {
                    return;
                }

                if (!needConfirm)
                {
                    return;
                }
                p.Message("Type %T/os map resize {0} {1} {2} confirm %Sif you're sure.",
                          args[1], args[2], args[3]);
            }
            else if (cmd == "PERVISIT")
            {
                // Older realm maps didn't put you on visit whitelist, so make sure we put the owner here
                AccessController access = p.level.VisitAccess;
                if (!access.Whitelisted.CaselessContains(p.name))
                {
                    access.Whitelist(Player.Console, LevelPermission.Nobody, p.level, p.name);
                }

                if (value.Length > 0)
                {
                    value = p.level.name + " " + value;
                }
                UseCommand(p, "PerVisit", value);
            }
            else if (cmd == "PERBUILD")
            {
                if (value.Length > 0)
                {
                    value = p.level.name + " " + value;
                }
                UseCommand(p, "PerBuild", value);
            }
            else if (cmd == "TEXTURE" || cmd == "TEXTUREZIP" || cmd == "TEXTUREPACK")
            {
                if (value.Length == 0)
                {
                    value = "normal";
                }
                UseCommand(p, "Texture", "levelzip " + value);
            }
            else
            {
                LevelOption opt = LevelOptions.Find(cmd);
                if (opt == null)
                {
                    p.MessageLines(mapHelp);
                }
                else if (DisallowedMapOption(opt.Name))
                {
                    p.Message("%WYou cannot change that map option via /os map."); return;
                }
                else
                {
                    opt.SetFunc(p, p.level, value);
                    p.level.SaveSettings();
                }
            }
        }
Esempio n. 39
0
 public void GoToGame(LevelInfo info)
 {
     LevelSelected = info;
     SceneManager.LoadScene("Game");
 }
Esempio n. 40
0
    private static void BuildTile(char tileChar, int x, int y, Tilemap tilemap, Camera2DFollow follow, LevelInfo levelInfo)
    {
        Tile       tile = tileChar.ToTile();
        Vector3Int pos  = new Vector3Int(x, y, 0);
        GameObject go   = null;

        switch (tile)
        {
        case Tile.empty:
        case Tile.block:
        case Tile.crate:
            tilemap.SetTile(pos, tile.GetPrefab());
            break;

        case Tile.playerOneFinish:
            go = Resources.Load <GameObject>("Prefabs/EndGoal");
            break;

        case Tile.playerOneStart:
            if (levelInfo.Player == null)
            {
                go = Resources.Load <GameObject>("Prefabs/Character");
            }
            break;

        case Tile.basicEnemyReverse:
        case Tile.basicEnemy:
            go = Resources.Load <GameObject>("Prefabs/BasicEnemy");
            break;

        case Tile.coin:
            go = Resources.Load <GameObject>("Prefabs/Coin");
            break;

        case Tile.acceleratingEnemyReverse:
        case Tile.acceleratingEnemy:
            go = Resources.Load <GameObject>("Prefabs/AcceleratingEnemy");
            break;

        case Tile.missileLauncherReverse:
        case Tile.missileLauncher:
            go = Resources.Load <GameObject>("Prefabs/MissileLauncher");
            break;

        default:
            Debug.LogWarning($"{tile} not found.");
            break;
        }

        if (go != null)
        {
            go = Object.Instantiate(go);
            go.transform.position = tilemap.GetCellCenterWorld(pos);

            if (tile.IsReverseTile())
            {
                go.transform.eulerAngles = new Vector3(0, 180, 0);
            }

            if (tile == Tile.playerOneStart)
            {
                follow.target            = go.transform;
                levelInfo.Player         = go.GetComponent <Player>();
                levelInfo.Player.LowestY = CalculateLowestY(tilemap);
            }
            else if (tile.NeedsMap())
            {
                go.GetComponent <BaseBehavior>().Map = tilemap;
                levelInfo.Enemies.Add(go);
            }
            else if (tile == Tile.playerOneFinish)
            {
                levelInfo.EndLevelTiles.Add(go.GetComponent <EndLevel>());
            }
            else if (tile == Tile.missileLauncher || tile == Tile.missileLauncherReverse)
            {
                levelInfo.Turrets.Add(go);
            }
            else if (tile == Tile.coin)
            {
                levelInfo.Coins.Add(go.GetComponent <CollectCoin>());
            }
        }
    }
Esempio n. 41
0
        public MoveLevelWindow(LevelService levelService, WorldService worldService, WorldInfo hostWorld, LevelInfo parentLevel)
        {
            InitializeComponent();

            _levelService       = levelService;
            _worldService       = worldService;
            _defaultParentLevel = parentLevel;

            WorldList.ItemsSource = _worldService.AllWorlds();

            if (parentLevel == null)
            {
                LevelList.SelectedIndex = 0;
            }
            else
            {
                LevelList.SelectedItem = parentLevel;
            }

            if (hostWorld != null)
            {
                WorldList.SelectedItem = hostWorld;
            }
        }
Esempio n. 42
0
    private static void InitData()
    {
        if (!initialized)
        {
            initialized = true;
            Levels      = new LevelInfo[33];
            Levels[0]   = new LevelInfo();
            Levels[1]   = new LevelInfo();
            Levels[2]   = new LevelInfo();
            Levels[3]   = new LevelInfo();
            Levels[4]   = new LevelInfo();
            Levels[5]   = new LevelInfo();
            Levels[6]   = new LevelInfo();
            Levels[7]   = new LevelInfo();
            Levels[8]   = new LevelInfo();
            Levels[9]   = new LevelInfo();
            Levels[10]  = new LevelInfo();
            Levels[11]  = new LevelInfo();
            Levels[12]  = new LevelInfo();
            Levels[13]  = new LevelInfo();
            Levels[14]  = new LevelInfo();
            Levels[15]  = new LevelInfo();
            Levels[16]  = new LevelInfo();
            Levels[17]  = new LevelInfo();
            Levels[18]  = new LevelInfo();
            Levels[19]  = new LevelInfo();
            Levels[20]  = new LevelInfo();
            Levels[21]  = new LevelInfo();
            Levels[22]  = new LevelInfo();
            Levels[23]  = new LevelInfo();
            Levels[24]  = new LevelInfo();
            Levels[25]  = new LevelInfo();
            Levels[26]  = new LevelInfo();

            Levels[0].Name        = "The City";
            Levels[0].MapName     = "The City I";
            Levels[0].Description = "kill all the titans with your friends.(No RESPAWN/SUPPLY/PLAY AS TITAN)";
            Levels[0].EnemyNumber = 10;
            Levels[0].Mode        = GameMode.KillTitan;
            Levels[0].RespawnMode = RespawnMode.NEVER;
            Levels[0].Supply      = true;
            Levels[0].TeamTitan   = true;
            Levels[0].PVPEnabled  = true;
            Levels[0].DiscordName = "city";
            Levels[0].LogicType   = typeof(GameLogic.KillTitanLogic);

            Levels[1].Name        = "The City II";
            Levels[1].MapName     = "The City I";
            Levels[1].Description = "Fight the titans with your friends.(RESPAWN AFTER 10 SECONDS/SUPPLY/TEAM TITAN)";
            Levels[1].EnemyNumber = 10;
            Levels[1].Mode        = GameMode.KillTitan;
            Levels[1].RespawnMode = RespawnMode.DEATHMATCH;
            Levels[1].Supply      = true;
            Levels[1].TeamTitan   = true;
            Levels[1].PVPEnabled  = true;
            Levels[1].DiscordName = "city";
            Levels[1].LogicType   = typeof(GameLogic.KillTitanLogic);

            //Levels[2].Name = "Cage Fighting";
            //Levels[2].MapName = "Cage Fighting";
            //Levels[2].Description = "2 players in different cages. when you kill a titan,  one or more titan will spawn to your opponent's cage.";
            //Levels[2].EnemyNumber = 1;
            //Levels[2].Mode = GameMode.CAGE_FIGHT;
            //Levels[2].RespawnMode = RespawnMode.NEVER;
            //Levels[2].DiscordName = "cage-fight";

            Levels[3].Name        = "The Forest";
            Levels[3].MapName     = "The Forest";
            Levels[3].Description = "The Forest Of Giant Trees.(No RESPAWN/SUPPLY/PLAY AS TITAN)";
            Levels[3].EnemyNumber = 5;
            Levels[3].Mode        = GameMode.KillTitan;
            Levels[3].RespawnMode = RespawnMode.NEVER;
            Levels[3].Supply      = true;
            Levels[3].TeamTitan   = true;
            Levels[3].PVPEnabled  = true;
            Levels[3].DiscordName = "forest";
            Levels[3].LogicType   = typeof(GameLogic.KillTitanLogic);
            Levels[3].HasFog      = true;

            Levels[4].Name        = "The Forest II";
            Levels[4].MapName     = "The Forest";
            Levels[4].Description = "Survive for 20 waves.";
            Levels[4].EnemyNumber = 3;
            Levels[4].Mode        = GameMode.SurviveMode;
            Levels[4].RespawnMode = RespawnMode.NEVER;
            Levels[4].Supply      = true;
            Levels[4].DiscordName = "forest";
            Levels[4].LogicType   = typeof(GameLogic.SurviveLogic);
            Levels[4].HasFog      = true;

            Levels[5].Name        = "The Forest III";
            Levels[5].MapName     = "The Forest";
            Levels[5].Description = "Survive for 20 waves.player will respawn in every new wave";
            Levels[5].EnemyNumber = 3;
            Levels[5].Mode        = GameMode.SurviveMode;
            Levels[5].RespawnMode = RespawnMode.NEWROUND;
            Levels[5].Supply      = true;
            Levels[5].DiscordName = "forest";
            Levels[5].LogicType   = typeof(GameLogic.SurviveLogic);
            Levels[5].HasFog      = true;

            Levels[6].Name         = "Annie";
            Levels[6].MapName      = "The Forest";
            Levels[6].Description  = "Nape Armor/ Ankle Armor:\nNormal:1000/50\nHard:2500/100\nAbnormal:4000/200\nYou only have 1 life.Don't do this alone.";
            Levels[6].EnemyNumber  = 15;
            Levels[6].Mode         = GameMode.KillTitan;
            Levels[6].RespawnMode  = RespawnMode.NEVER;
            Levels[6].PunksEnabled = false;
            Levels[6].PVPEnabled   = true;
            Levels[6].DiscordName  = "annie";
            Levels[6].LogicType    = typeof(GameLogic.KillTitanLogic);
            Levels[6].HasFog       = true;

            Levels[7].Name         = "Annie II";
            Levels[7].MapName      = "The Forest";
            Levels[7].Description  = "Nape Armor/ Ankle Armor:\nNormal:1000/50\nHard:3000/200\nAbnormal:6000/1000\n(RESPAWN AFTER 10 SECONDS)";
            Levels[7].EnemyNumber  = 15;
            Levels[7].Mode         = GameMode.KillTitan;
            Levels[7].RespawnMode  = RespawnMode.DEATHMATCH;
            Levels[7].PunksEnabled = false;
            Levels[7].PVPEnabled   = true;
            Levels[7].DiscordName  = "annie";
            Levels[7].LogicType    = typeof(GameLogic.KillTitanLogic);
            Levels[7].HasFog       = true;

            Levels[8].Name        = "Colossal Titan";
            Levels[8].MapName     = "Colossal Titan";
            Levels[8].Description = "Defeat the Colossal Titan.\nPrevent the abnormal titan from running to the north gate.\n Nape Armor:\n Normal:2000\nHard:3500\nAbnormal:5000\n";
            Levels[8].EnemyNumber = 2;
            Levels[8].Mode        = GameMode.BossFightCT;
            Levels[8].RespawnMode = RespawnMode.NEVER;
            Levels[8].DiscordName = "colossal";
            Levels[8].LogicType   = typeof(GameLogic.CTFightLogic);

            Levels[9].Name        = "Colossal Titan II";
            Levels[9].MapName     = "Colossal Titan";
            Levels[9].Description = "Defeat the Colossal Titan.\nPrevent the abnormal titan from running to the north gate.\n Nape Armor:\n Normal:5000\nHard:8000\nAbnormal:12000\n(RESPAWN AFTER 10 SECONDS)";
            Levels[9].EnemyNumber = 2;
            Levels[9].Mode        = GameMode.BossFightCT;
            Levels[9].RespawnMode = RespawnMode.DEATHMATCH;
            Levels[9].DiscordName = "colossal";
            Levels[9].LogicType   = typeof(GameLogic.CTFightLogic);

            Levels[10].Name         = "Trost";
            Levels[10].MapName      = "Colossal Titan";
            Levels[10].Description  = "Escort Titan Eren";
            Levels[10].EnemyNumber  = 2;
            Levels[10].Mode         = GameMode.Trost;
            Levels[10].RespawnMode  = RespawnMode.NEVER;
            Levels[10].PunksEnabled = false;
            Levels[10].DiscordName  = "city";
            Levels[10].LogicType    = typeof(GameLogic.TrostLogic);

            Levels[11].Name         = "Trost II";
            Levels[11].MapName      = "Colossal Titan";
            Levels[11].Description  = "Escort Titan Eren(RESPAWN AFTER 10 SECONDS)";
            Levels[11].EnemyNumber  = 2;
            Levels[11].Mode         = GameMode.Trost;
            Levels[11].RespawnMode  = RespawnMode.DEATHMATCH;
            Levels[11].PunksEnabled = false;
            Levels[11].DiscordName  = "city";
            Levels[11].LogicType    = typeof(GameLogic.TrostLogic);

            Levels[12].Name        = "[S]City";
            Levels[12].MapName     = "The City I";
            Levels[12].Description = "Kill all 15 Titans";
            Levels[12].EnemyNumber = 15;
            Levels[12].Mode        = GameMode.KillTitan;
            Levels[12].RespawnMode = RespawnMode.NEVER;
            Levels[12].Supply      = true;
            Levels[12].DiscordName = "city";
            Levels[12].LogicType   = typeof(GameLogic.KillTitanLogic);

            Levels[13].Name        = "[S]Forest";
            Levels[13].MapName     = "The Forest";
            Levels[13].Description = string.Empty;
            Levels[13].EnemyNumber = 15;
            Levels[13].Mode        = GameMode.KillTitan;
            Levels[13].RespawnMode = RespawnMode.NEVER;
            Levels[13].Supply      = true;
            Levels[13].DiscordName = "forest";
            Levels[13].LogicType   = typeof(GameLogic.KillTitanLogic);
            Levels[13].HasFog      = true;

            Levels[14].Name         = "[S]Forest Survive(no crawler)";
            Levels[14].MapName      = "The Forest";
            Levels[14].Description  = string.Empty;
            Levels[14].EnemyNumber  = 3;
            Levels[14].Mode         = GameMode.SurviveMode;
            Levels[14].RespawnMode  = RespawnMode.NEVER;
            Levels[14].Supply       = true;
            Levels[14].NoCrawler    = true;
            Levels[14].PunksEnabled = true;
            Levels[14].DiscordName  = "forest";
            Levels[14].LogicType    = typeof(GameLogic.SurviveLogic);
            Levels[14].HasFog       = true;

            Levels[15].Name         = "[S]Tutorial";
            Levels[15].MapName      = "tutorial";
            Levels[15].Description  = string.Empty;
            Levels[15].EnemyNumber  = 1;
            Levels[15].Mode         = GameMode.KillTitan;
            Levels[15].RespawnMode  = RespawnMode.NEVER;
            Levels[15].Supply       = true;
            Levels[15].Hint         = true;
            Levels[15].PunksEnabled = false;
            Levels[15].DiscordName  = "anarchyicon";
            Levels[15].LogicType    = typeof(GameLogic.KillTitanLogic);

            Levels[16].Name         = "[S]Battle training";
            Levels[16].MapName      = "tutorial 1";
            Levels[16].Description  = string.Empty;
            Levels[16].EnemyNumber  = 7;
            Levels[16].Mode         = GameMode.KillTitan;
            Levels[16].RespawnMode  = RespawnMode.NEVER;
            Levels[16].Supply       = true;
            Levels[16].PunksEnabled = false;
            Levels[16].DiscordName  = "anarchyicon";
            Levels[16].LogicType    = typeof(GameLogic.KillTitanLogic);

            Levels[17].Name        = "The Forest IV  - LAVA";
            Levels[17].MapName     = "The Forest";
            Levels[17].Description = "Survive for 20 waves.player will respawn in every new wave.\nNO CRAWLERS\n***YOU CAN'T TOUCH THE GROUND!***";
            Levels[17].EnemyNumber = 3;
            Levels[17].Mode        = GameMode.SurviveMode;
            Levels[17].RespawnMode = RespawnMode.NEWROUND;
            Levels[17].Supply      = true;
            Levels[17].NoCrawler   = true;
            Levels[17].LavaMode    = true;
            Levels[17].DiscordName = "forest";
            Levels[17].LogicType   = typeof(GameLogic.SurviveLogic);
            Levels[17].HasFog      = true;

            Levels[18].Name        = "[S]Racing - Akina";
            Levels[18].MapName     = "track - akina";
            Levels[18].Description = string.Empty;
            Levels[18].EnemyNumber = 0;
            Levels[18].Mode        = GameMode.Racing;
            Levels[18].RespawnMode = RespawnMode.NEVER;
            Levels[18].Supply      = false;
            Levels[18].DiscordName = "racing-akina";
            Levels[18].LogicType   = typeof(GameLogic.RacingLogic);

            Levels[19].Name        = "Racing - Akina";
            Levels[19].MapName     = "track - akina";
            Levels[19].Description = string.Empty;
            Levels[19].EnemyNumber = 0;
            Levels[19].Mode        = GameMode.Racing;
            Levels[19].RespawnMode = RespawnMode.NEVER;
            Levels[19].Supply      = false;
            Levels[19].PVPEnabled  = true;
            Levels[19].DiscordName = "racing-akina";
            Levels[19].LogicType   = typeof(GameLogic.RacingLogic);

            Levels[20].Name          = "Outside The Walls";
            Levels[20].MapName       = "OutSide";
            Levels[20].Description   = "Capture Checkpoint mode.";
            Levels[20].EnemyNumber   = 0;
            Levels[20].Mode          = GameMode.PVP_CAPTURE;
            Levels[20].RespawnMode   = RespawnMode.DEATHMATCH;
            Levels[20].Supply        = true;
            Levels[20].HorsesEnabled = true;
            Levels[20].TeamTitan     = true;
            Levels[20].DiscordName   = "outside-the-walls";
            Levels[20].LogicType     = typeof(GameLogic.PVPCaptureLogic);

            Levels[21].Name          = "The City III";
            Levels[21].MapName       = "The City I";
            Levels[21].Description   = "Capture Checkpoint mode.";
            Levels[21].EnemyNumber   = 0;
            Levels[21].Mode          = GameMode.PVP_CAPTURE;
            Levels[21].RespawnMode   = RespawnMode.DEATHMATCH;
            Levels[21].Supply        = true;
            Levels[21].HorsesEnabled = false;
            Levels[21].TeamTitan     = true;
            Levels[21].DiscordName   = "city";
            Levels[21].LogicType     = typeof(GameLogic.PVPCaptureLogic);

            Levels[22].Name          = "Cave Fight";
            Levels[22].MapName       = "CaveFight";
            Levels[22].Description   = "***Spoiler Alarm!***";
            Levels[22].EnemyNumber   = -1;
            Levels[22].Mode          = GameMode.PvpAhss;
            Levels[22].RespawnMode   = RespawnMode.NEVER;
            Levels[22].Supply        = true;
            Levels[22].HorsesEnabled = false;
            Levels[22].TeamTitan     = true;
            Levels[22].PVPEnabled    = true;
            Levels[22].DiscordName   = "cage-fight";
            Levels[22].LogicType     = typeof(GameLogic.PVPLogic);

            Levels[23].Name          = "House Fight";
            Levels[23].MapName       = "HouseFight";
            Levels[23].Description   = "***Spoiler Alarm!***";
            Levels[23].EnemyNumber   = -1;
            Levels[23].Mode          = GameMode.PvpAhss;
            Levels[23].RespawnMode   = RespawnMode.NEVER;
            Levels[23].Supply        = true;
            Levels[23].HorsesEnabled = false;
            Levels[23].TeamTitan     = true;
            Levels[23].PVPEnabled    = true;
            Levels[23].DiscordName   = "house-fight";
            Levels[23].LogicType     = typeof(GameLogic.PVPLogic);

            Levels[24].Name         = "[S]Forest Survive(no crawler no punk)";
            Levels[24].MapName      = "The Forest";
            Levels[24].Description  = string.Empty;
            Levels[24].EnemyNumber  = 3;
            Levels[24].Mode         = GameMode.SurviveMode;
            Levels[24].RespawnMode  = RespawnMode.NEVER;
            Levels[24].Supply       = true;
            Levels[24].NoCrawler    = true;
            Levels[24].PunksEnabled = false;
            Levels[24].DiscordName  = "forest";
            Levels[24].LogicType    = typeof(GameLogic.SurviveLogic);
            Levels[24].HasFog       = true;

            Levels[25].Name         = "Custom";
            Levels[25].MapName      = "The Forest";
            Levels[25].Description  = "Custom Map.";
            Levels[25].EnemyNumber  = 1;
            Levels[25].Mode         = GameMode.KillTitan;
            Levels[25].RespawnMode  = RespawnMode.NEVER;
            Levels[25].Supply       = true;
            Levels[25].TeamTitan    = true;
            Levels[25].PVPEnabled   = true;
            Levels[25].PunksEnabled = true;
            Levels[25].DiscordName  = "custom";
            Levels[25].LogicType    = typeof(GameLogic.KillTitanLogic);
            Levels[25].HasFog       = true;

            Levels[26].Name         = "Custom (No PT)";
            Levels[26].MapName      = "The Forest";
            Levels[26].Description  = "Custom Map (No Player Titans).";
            Levels[26].EnemyNumber  = 1;
            Levels[26].Mode         = GameMode.KillTitan;
            Levels[26].RespawnMode  = RespawnMode.NEVER;
            Levels[26].Supply       = true;
            Levels[26].TeamTitan    = false;
            Levels[26].PVPEnabled   = true;
            Levels[26].PunksEnabled = true;
            Levels[26].DiscordName  = "custom";
            Levels[16].LogicType    = typeof(GameLogic.KillTitanLogic);
            Levels[16].HasFog       = true;

            Levels[0].minimapPreset  = new Minimap.Preset(new Vector3(22.6f, 0f, 13f), 731.9738f);
            Levels[8].minimapPreset  = new Minimap.Preset(new Vector3(8.8f, 0f, 65f), 765.5751f);
            Levels[9].minimapPreset  = new Minimap.Preset(new Vector3(8.8f, 0f, 65f), 765.5751f);
            Levels[18].minimapPreset = new Minimap.Preset(new Vector3(443.2f, 0f, 1912.6f), 1929.042f);
            Levels[19].minimapPreset = new Minimap.Preset(new Vector3(443.2f, 0f, 1912.6f), 1929.042f);
            Levels[20].minimapPreset = new Minimap.Preset(new Vector3(2549.4f, 0f, 3042.4f), 3697.16f);
            Levels[21].minimapPreset = new Minimap.Preset(new Vector3(22.6f, 0f, 13f), 734.9738f);

            //Guardian maps (27,28,29)
            Levels[27] = new LevelInfo();//TODO: Multi-Map
            Levels[28] = new LevelInfo
            {
                Name        = "The City IV",
                MapName     = "The City I",
                Description = "Survive all 20 waves. (No respawns)",
                EnemyNumber = 3,
                Mode        = GameMode.SurviveMode,
                RespawnMode = RespawnMode.NEVER,
                Supply      = true,
                DiscordName = "city",
                LogicType   = typeof(GameLogic.SurviveLogic)
            };
            Levels[29] = new LevelInfo
            {
                Name        = "The City V",
                MapName     = "The City I",
                Description = "Survive all 20 waves. (Respawn on each new wave)",
                EnemyNumber = 3,
                Mode        = GameMode.SurviveMode,
                RespawnMode = RespawnMode.NEWROUND,
                Supply      = true,
                DiscordName = "city",
                LogicType   = typeof(GameLogic.SurviveLogic)
            };
            //Anarchy maps (30)
            Levels[30] = new LevelInfo
            {
                Name         = "Custom-Anarchy (No PT)",
                MapName      = "The Forest",
                Description  = "Custom maps with Anarchy extension (No PT)",
                EnemyNumber  = 1,
                Mode         = GameMode.KillTitan,
                RespawnMode  = RespawnMode.NEVER,
                Supply       = true,
                TeamTitan    = false,
                PVPEnabled   = true,
                PunksEnabled = true,
                DiscordName  = "custom",
                LogicType    = typeof(GameLogic.KillTitanLogic),
                HasFog       = true
            };

            Levels[31] = new LevelInfo
            {
                Name         = "Racing - Custom",
                MapName      = "The Forest",
                Description  = "Custom map dedicated to use for Racing gamemode",
                EnemyNumber  = 0,
                Mode         = GameMode.Racing,
                RespawnMode  = RespawnMode.NEVER,
                Supply       = false,
                TeamTitan    = false,
                PVPEnabled   = false,
                PunksEnabled = false,
                DiscordName  = "custom",
                LogicType    = typeof(GameLogic.CustomRacingLogic),
                HasFog       = true
            };

            Levels[32] = new LevelInfo
            {
                Name         = "Forest - Bomb",
                MapName      = "The Forest",
                Description  = "Custom map dedicated to use for Racing gamemode",
                EnemyNumber  = 0,
                Mode         = GameMode.Bomb,
                RespawnMode  = RespawnMode.NEVER,
                Supply       = true,
                TeamTitan    = false,
                PVPEnabled   = false,
                PunksEnabled = false,
                DiscordName  = "forest",
                LogicType    = typeof(GameLogic.CustomRacingLogic),
                HasFog       = true
            };
        }
    }
Esempio n. 43
0
        private void RoomCreation()
        {
            left.Reset();
            right.Reset();
            LabelCenter(left, locale["roomSettings"], true);
            serverName = TextField(left, serverName, locale["roomName"], Style.LabelOffset, true);
            password   = TextField(left, password, locale["pwd"], Style.LabelOffset, true);
            serverTime = TextField(left, serverTime, locale["time"], Style.LabelOffset * 2f, true);
            maxPlayers = TextField(left, maxPlayers, locale["players"], Style.LabelOffset * 2f, true);

            LabelCenter(left, locale["difficulity"], true);
            difficulity = SelectionGrid(left, difficulity, difficulities, difficulities.Length, true);

            LabelCenter(left, locale["dayLight"], true);
            daylight = SelectionGrid(left, daylight, daylights, daylights.Length, true);
            left.MoveY();

            LabelCenter(left, locale["presets"], true);
            Label(left, locale["presetNote"], true);
            newPresetName = TextField(left, newPresetName, locale["presetName"], Style.LabelOffset, true);
            left.width    = (left.DefaultWidth - Style.HorizontalMargin) / 2f;
            if (Button(left, locale["presetAdd"], false))
            {
                ServerPreset set = new ServerPreset(newPresetName);
                ExportPreset(set);
                presets.Add(set);
                presetView.height = (presets.Count * Style.Height) + ((presets.Count - 1) * Style.VerticalMargin);
                set.Save();
            }
            left.MoveX();
            if (Button(left, locale["presetRemove"], true))
            {
                if (presets.Count > 1)
                {
                    ServerPreset selected = null;
                    for (int i = 0; i < presets.Count; i++)
                    {
                        if (presets[i].Name == newPresetName)
                        {
                            selected = presets[i];
                        }
                    }
                    if (selected != null)
                    {
                        presets.Remove(selected);
                        selected.Delete();
                        newPresetName = "Set " + (presets.Count + 1);
                        if (presets.Count > 0)
                        {
                            newPresetName = presets[presets.Count - 1].Name;
                        }

                        presetView.height = (presets.Count * Style.Height) + ((presets.Count - 1) * Style.VerticalMargin);
                    }
                }
            }
            left.ResetX();
            if (presets.Count > 0)
            {
                presetArea.y = left.y;
                presetRect.Reset();
                presetScroll = BeginScrollView(presetArea, presetScroll, presetView);
                {
                    for (int i = 0; i < presets.Count; i++)
                    {
                        if (Button(presetRect, presets[i].Name, true))
                        {
                            ServerPreset selected = presets[i];
                            ImportPreset(selected);
                        }
                    }
                }
                EndScrollView();
            }

            left.MoveToEndY(WindowPosition, Style.Height);
            left.width = left.DefaultWidth / 2f - Style.HorizontalMargin;
            if (Button(left, locale["btnCreation"], false))
            {
                disconnectByJoin = true;
                serverTime       = serverTime.Trim();
                int serverTimeInt;
                if (!int.TryParse(serverTime, out serverTimeInt))
                {
                    serverTimeInt = 120;
                }

                daylight    = daylight > 2 ? 0 : daylight;
                difficulity = difficulity > 2 ? 0 : difficulity;

                string mapName = string.Empty;

                try
                {
                    mapName = maps[mapSelectionSetting];
                }
                catch (System.Exception ex)
                {
                    Debug.LogError("Room creation exception appeared: " + ex.Message + "\n" + ex.StackTrace + $"\nSetting info: {mapSelectionSetting}");
                    mapSelectionSetting.Value = 0;
                    mapName = maps[mapSelectionSetting.Value];
                }

                string[] args = new string[]
                {
                    serverName,
                    mapName,
                    new string[] { "normal", "hard", "abnormal" }[difficulity],
                    serverTimeInt.ToString(),
                    new string[] { "day", "dawn", "night" }[daylight],
                    password.Length > 0 ? new SimpleAES().Encrypt(password) : string.Empty,
                    UnityEngine.Random.Range(1000000, 10000000).ToString()
                };
                if (!int.TryParse(maxPlayers, out int max))
                {
                    max = 5;
                }
                PhotonNetwork.CreateRoom(string.Join("`", args), new RoomOptions()
                {
                    isVisible = true, isOpen = true, maxPlayers = max
                }, null);
                DisableImmediate();
                AnarchyManager.Background.Disable();
                return;
            }
            left.MoveX(Style.HorizontalMargin, true);
            if (Button(left, locale["btnOffline"], false))
            {
                disconnectByJoin = true;
                PhotonNetwork.Disconnect();
                PhotonNetwork.offlineMode = true;
                string[] args = new string[]
                {
                    serverName,
                    maps[mapSelectionSetting.Value],
                    new string[] { "normal", "hard", "abnormal" }[difficulity],
                    serverTime,
                    new string[] { "day", "dawn", "night" }[daylight],
                    password.Length > 0 ? new SimpleAES().Encrypt(password) : string.Empty,
                    UnityEngine.Random.Range(1000000, 10000000).ToString()
                };
                if (!int.TryParse(maxPlayers, out int max))
                {
                    max = 5;
                }
                PhotonNetwork.CreateRoom(string.Join("`", args), new RoomOptions()
                {
                    isVisible = true, isOpen = true, maxPlayers = max
                }, null);
                DisableImmediate();
                AnarchyManager.Background.Disable();
                return;
            }

            LabelCenter(right, locale["mapSelection"], true);
            //mapSelection = SelectionGrid(right, mapSelection, maps, 1);
            DropdownMenuScrollable(this, right, mapSelectionSetting, maps, 10, true);
            right.MoveY();
            right.MoveY();
            Label(right, LevelInfo.GetInfo(maps[mapSelectionSetting.Value], false).Description, true);
            right.MoveToEndY(WindowPosition, Style.Height);
            right.MoveToEndX(WindowPosition, new AutoScaleFloat(240f) + Style.HorizontalMargin);
            right.width = new AutoScaleFloat(120f);
            if (Button(right, locale["btnSettings"], false))
            {
                connected     = false;
                pageSelection = SettingsPage;
                return;
            }
            right.MoveX();
            if (Button(right, locale["btnList"], false))
            {
                connected = PhotonNetwork.connected;
                if (connected)
                {
                    timeToUpdate = 0.1f;
                }
                pageSelection = ServerListPage;
                return;
            }
        }
Esempio n. 44
0
    public bool checkObj(string key, PhotonPlayer photonPlayer, int[] viewIDS)
    {
        if (photonPlayer.isMasterClient || photonPlayer.isLocal)
        {
            return(true);
        }
        int num  = photonPlayer.ID * PhotonNetwork.MAX_VIEW_IDS;
        int num2 = num + PhotonNetwork.MAX_VIEW_IDS;

        foreach (int num3 in viewIDS)
        {
            if ((num3 <= num) || (num3 >= num2))
            {
                if (PhotonNetwork.isMasterClient)
                {
                    FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning invalid photon view.");
                }
                return(false);
            }
        }
        key = key.ToLower();

        switch (key)
        {
        case "rcasset/bombmain":
        case "rcasset/bombexplodemain":
            if (RCSettings.bombMode <= 0)
            {
                if (!(!PhotonNetwork.isMasterClient || FengGameManagerMKII.instance.restartingBomb))
                {
                    FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning bomb item (" + key + ").");
                }
                return(false);
            }
            return(this.Instantiated(photonPlayer, GameResource.bomb));

        case "hook":
        case "aottg_hero 1":
            return(this.Instantiated(photonPlayer, GameResource.general));

        case "hitmeat2":
            return(this.Instantiated(photonPlayer, GameResource.bloodEffect));

        case "hitmeat":
        case "redcross":
        case "redcross1":
            return(this.Instantiated(photonPlayer, GameResource.bladeHit));

        case "fx/flarebullet1":
        case "fx/flarebullet2":
        case "fx/flarebullet3":
            return(this.Instantiated(photonPlayer, GameResource.flare));

        case "fx/shotgun":
        case "fx/shotgun 1":
            return(this.Instantiated(photonPlayer, GameResource.shotGun));

        case "fx/fxtitanspawn":
        case "fx/boom1":
        case "fx/boom3":
        case "fx/boom5":
        case "fx/rockthrow":
        case "fx/bite":
            if ((LevelInfo.getInfo(FengGameManagerMKII.level).teamTitan || (RCSettings.infectionMode > 0)) || (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT))
            {
                return(this.Instantiated(photonPlayer, GameResource.effect));
            }
            if (!(!PhotonNetwork.isMasterClient || FengGameManagerMKII.instance.restartingTitan))
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning titan effects.");
            }
            return(false);

        case "fx/boom2":
        case "fx/boom4":
        case "fx/fxtitandie":
        case "fx/fxtitandie1":
        case "fx/boost_smoke":
        case "fx/thunder":
            return(this.Instantiated(photonPlayer, GameResource.effect));

        case "rcasset/cannonballobject":
            return(this.Instantiated(photonPlayer, GameResource.bomb));

        case "rcasset/cannonwall":
        case "rcasset/cannonground":
            if (PhotonNetwork.isMasterClient && !(FengGameManagerMKII.instance.allowedToCannon.ContainsKey(photonPlayer.ID) || FengGameManagerMKII.instance.restartingMC))
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning cannon item (" + key + ").");
            }
            return(this.Instantiated(photonPlayer, GameResource.general));

        case "rcasset/cannonwallprop":
        case "rcasset/cannongroundprop":
            if (PhotonNetwork.isMasterClient)
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning MC item (" + key + ").");
            }
            return(false);

        case "titan_eren":
            if (!(RCextensions.returnStringFromObject(photonPlayer.customProperties[PhotonPlayerProperty.character]).ToUpper() != "EREN"))
            {
                if (RCSettings.banEren > 0)
                {
                    if (PhotonNetwork.isMasterClient && !FengGameManagerMKII.instance.restartingEren)
                    {
                        FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning titan eren (" + key + ").");
                    }
                    return(false);
                }
                return(this.Instantiated(photonPlayer, GameResource.general));
            }
            if (PhotonNetwork.isMasterClient)
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning titan eren (" + key + ").");
            }
            return(false);

        case "fx/justSmoke":
        case "bloodexplore":
        case "bloodsplatter":
            return(this.Instantiated(photonPlayer, GameResource.effect));

        case "hitmeatbig":
            if (!(RCextensions.returnStringFromObject(photonPlayer.customProperties[PhotonPlayerProperty.character]).ToUpper() != "EREN"))
            {
                if (RCSettings.banEren > 0)
                {
                    if (!(!PhotonNetwork.isMasterClient || FengGameManagerMKII.instance.restartingEren))
                    {
                        FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning eren effect (" + key + ").");
                    }
                    return(false);
                }
                return(this.Instantiated(photonPlayer, GameResource.effect));
            }
            if (PhotonNetwork.isMasterClient)
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning eren effect (" + key + ").");
            }
            return(false);

        case "fx/colossal_steam_dmg":
        case "fx/colossal_steam":
        case "fx/boom1_ct_kick":
            if (!PhotonNetwork.isMasterClient || (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT))
            {
                if (!photonPlayer.isMasterClient)
                {
                    //ModMain.instance.logToConsole("Player #" + photonPlayer.ID + " spawned the colossal titan effect: " + key);
                }
                return(this.Instantiated(photonPlayer, GameResource.effect));
            }
            FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning colossal effect (" + key + ").");
            return(false);

        case "rock":
            if (!PhotonNetwork.isMasterClient || (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT))
            {
                return(this.Instantiated(photonPlayer, GameResource.general));
            }
            FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning MC item (" + key + ").");
            return(false);

        case "horse":
            if (LevelInfo.getInfo(FengGameManagerMKII.level).horse || (RCSettings.horseMode != 0))
            {
                return(this.Instantiated(photonPlayer, GameResource.general));
            }
            if (!(!PhotonNetwork.isMasterClient || FengGameManagerMKII.instance.restartingHorse))
            {
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning horse (" + key + ").");
            }
            return(false);

        case "titan_ver3.1":
            int num4;
            if (!PhotonNetwork.isMasterClient)
            {
                if (FengGameManagerMKII.masterRC && (IN_GAME_MAIN_CAMERA.gamemode != GAMEMODE.BOSS_FIGHT_CT))
                {
                    num4 = 0;
                    foreach (TITAN titan in FengGameManagerMKII.instance.getTitans())
                    {
                        if (titan.photonView.owner == photonPlayer)
                        {
                            num4++;
                        }
                    }
                    if (num4 > 1)
                    {
                        return(false);
                    }
                }
                break;
            }
            if (((LevelInfo.getInfo(FengGameManagerMKII.level).teamTitan || (RCSettings.infectionMode > 0)) || (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT)) || FengGameManagerMKII.instance.restartingTitan)
            {
                if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT)
                {
                    break;
                }
                num4 = 0;
                foreach (TITAN titan in FengGameManagerMKII.instance.getTitans())
                {
                    if (titan.photonView.owner == photonPlayer)
                    {
                        num4++;
                    }
                }
                if (num4 <= 1)
                {
                    break;
                }
                FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning titan (" + key + ").");
                return(false);
            }
            FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, false, "spawning titan (" + key + ").");
            return(false);

        case "colossal_titan":
        case "female_titan":
        case "titan_eren_trost":
        case "aot_supply":
        case "monsterprefab":
        case "titan_new_1":
        case "titan_new_2":
            if (!PhotonNetwork.isMasterClient)
            {
                if (!photonPlayer.isMasterClient)
                {
                    //ModMain.instance.logToConsole("Player #" + photonPlayer.ID + " spawned MC prefab " + key);
                    return(false);
                }

                if (FengGameManagerMKII.masterRC)
                {
                    return(false);
                }
                return(this.Instantiated(photonPlayer, GameResource.general));
            }
            FengGameManagerMKII.instance.kickPlayerRC(photonPlayer, true, "spawning MC item (" + key + ").");
            return(false);

        default:
            return(false);
        }
        return(this.Instantiated(photonPlayer, GameResource.general));
    }
Esempio n. 45
0
        public void UpdateGUI(float timeSinceLastFrame)
        {
            if (!EngineConfig.DisplayingMinimap)
            {
                return;
            }
            if (gameScreen != null && gameScreen.CurrentLevel != null && !closing)
            {
                switch (gameScreen.CurrentLevel.UserPlane.Weapon.SelectWeapon)
                {
                case WeaponType.Bomb:
                    ammoElement.Caption = gameScreen.CurrentLevel.UserPlane.Weapon.BombCount.ToString();
                    break;

                case WeaponType.Rocket:
                    ammoElement.Caption = gameScreen.CurrentLevel.UserPlane.Weapon.RocketCount.ToString();
                    break;

                case WeaponType.Torpedo:
                    ammoElement.Caption = gameScreen.CurrentLevel.UserPlane.Weapon.TorpedoCount.ToString();
                    break;
                }



                // ammoTypeElement.Caption = gameScreen.CurrentLevel.UserPlane.Weapon.SelectWeapon.ToString() + "s";


                livesElement.Caption   = gameScreen.CurrentLevel.Lives.ToString();
                scoreElement.Caption   = gameScreen.Score.ToString();
                hiscoreElement.Caption = gameScreen.GetHighscore().ToString();
                string levelName;
                if (gameScreen.LevelNo == 0)
                {
                    levelName = LevelInfo.GetCustomLevelName(gameScreen.LevelFile);
                }
                else
                {
                    levelName = LanguageResources.GetString(LanguageKey.Level) + ": " + gameScreen.LevelNo.ToString();
                }

                string difficulty = String.Format(@"{0}: ", LanguageResources.GetString(LanguageKey.Difficulty));
                switch (EngineConfig.Difficulty)
                {
                case EngineConfig.DifficultyLevel.Easy:
                    difficulty += LanguageResources.GetString(LanguageKey.Low);
                    break;

                case EngineConfig.DifficultyLevel.Medium:
                    difficulty += LanguageResources.GetString(LanguageKey.Medium);
                    break;

                case EngineConfig.DifficultyLevel.Hard:
                    difficulty += LanguageResources.GetString(LanguageKey.High);
                    break;
                }

                if (EngineConfig.DebugInfo)
                {
                    if (gameScreen.CurrentLevel.MissionType == MissionType.BombingRun)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3} | {4}",
                                                            levelName,
                                                            difficulty,
                                                            LanguageResources.GetString(LanguageKey.EnemySoldiersLeft),
                                                            gameScreen.CurrentLevel.SoldiersCount,
                                                            gameScreen.Framework.UpdateStats());
                    }
                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Dogfight || gameScreen.CurrentLevel.MissionType == MissionType.Survival)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3} | {4}",
                                                            levelName,
                                                            difficulty,
                                                            LanguageResources.GetString(LanguageKey.EnemyPlanesLeft),
                                                            gameScreen.CurrentLevel.EnemyPlanesLeft,
                                                            gameScreen.Framework.UpdateStats());
                    }
                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Assassination)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3} | {4}",
                                                            levelName,
                                                            difficulty,
                                                            LanguageResources.GetString(LanguageKey.EnemyGenerals),
                                                            gameScreen.CurrentLevel.GeneralsCount,
                                                            gameScreen.Framework.UpdateStats());
                    }
                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Naval)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3} | {4}",
                                                            levelName,
                                                            difficulty,
                                                            LanguageResources.GetString(LanguageKey.EnemyShipsLeft),
                                                            gameScreen.CurrentLevel.ShipsLeft,
                                                            gameScreen.Framework.UpdateStats());
                    }
                }
                else
                {
                    if (gameScreen.CurrentLevel.MissionType == MissionType.BombingRun)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3}",
                                                            levelName,
                                                            difficulty,
                                                            // LanguageResources.GetString(LanguageKey.MissionType),
                                                            //   LanguageResources.GetString(LanguageKey.BombingRun),
                                                            LanguageResources.GetString(LanguageKey.EnemySoldiersLeft),
                                                            gameScreen.CurrentLevel.SoldiersCount);
                    }
                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Dogfight || gameScreen.CurrentLevel.MissionType == MissionType.Survival)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3}",
                                                            levelName,
                                                            difficulty,
                                                            //   LanguageResources.GetString(LanguageKey.MissionType),
                                                            //  LanguageResources.GetString(LanguageKey.Dogfight),
                                                            LanguageResources.GetString(LanguageKey.EnemyPlanesLeft),
                                                            gameScreen.CurrentLevel.EnemyPlanesLeft);
                    }

                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Assassination)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3}",
                                                            levelName,
                                                            difficulty,
                                                            //   LanguageResources.GetString(LanguageKey.MissionType),
                                                            //    LanguageResources.GetString(LanguageKey.Assassination),
                                                            LanguageResources.GetString(LanguageKey.Target),
                                                            (gameScreen.CurrentLevel.GeneralsCount == 0) ?
                                                            LanguageResources.GetString(LanguageKey.Neutralized) :
                                                            LanguageResources.GetString(LanguageKey.Alive));
                    }
                    else if (gameScreen.CurrentLevel.MissionType == MissionType.Naval)
                    {
                        infoElement.Caption = String.Format(@"{0} | {1} | {2}: {3}",
                                                            levelName,
                                                            difficulty,
                                                            // LanguageResources.GetString(LanguageKey.MissionType),
                                                            // LanguageResources.GetString(LanguageKey.Naval),
                                                            LanguageResources.GetString(LanguageKey.EnemyShipsLeft),
                                                            gameScreen.CurrentLevel.ShipsLeft);
                    }
                }
                if (EngineConfig.C_IS_INTERNAL_TEST)
                {
                    infoElement.Caption = EngineConfig.C_IS_INTERNAL_TEST_INFO + infoElement.Caption;
                }



                UpdateWheelState(this.gameScreen.CurrentLevel.UserPlane.WheelsState);
                UpdateFuelAndOilState(timeSinceLastFrame);
            }
        }
Esempio n. 46
0
 public static void InvokeLevelChanged(LevelInfo level, LevelInfo previous)
 {
     LevelChanged?.Invoke(level, previous);
 }
Esempio n. 47
0
 protected abstract void Initiate(out LevelInfo info);
Esempio n. 48
0
    /// <summary>
    /// Set data to the script of the level
    /// </summary>
    /// <param name="child"></param>
    /// <param name="theLevel"></param>
    private void SetDataLevelScript(GameObject child, LevelInfo theLevel)
    {
        //get the script to give the scene asociated to this level
        //and few information
        SceneLevel sceneLevel = child.GetComponent<SceneLevel>();
        sceneLevel.waitBeforeStartLevel = waitBeforeStartLevel;
        sceneLevel.level = _data.GetScene(theLevel);
        sceneLevel.infoLevel = theLevel;
        sceneLevel.menuMap = this;

        //Get the script to give the level asociated to this score
        ScoreLevel levelScore = _data.GetScoreLevel(theLevel);
        Score score = child.GetComponentInChildren<Score>();
        score.SetScore(levelScore.max, levelScore.achieved);
    }
Esempio n. 49
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length < 2)
            {
                OnStoreCommand(p); return;
            }
            LevelPreset preset = FindPreset(args[1]);

            if (preset == null)
            {
                p.Message("%WThat isn't a level preset"); return;
            }

            if (p.money < preset.price)
            {
                p.Message("%WYou don't have enough &3" + Server.Config.Currency + "%W to buy that map"); return;
            }

            string name = null;

            if (args.Length >= 3)
            {
                name = p.name + "_" + args[2];
            }
            else
            {
                // use a numbered map by default
                for (int i = 1; i < 100; i++)
                {
                    name = p.name + "_" + i;
                    if (!LevelInfo.MapExists(name))
                    {
                        break;
                    }
                }
            }

            p.Message("&aCreating level: '&f" + name + "&a' . . .");

            ushort x = 0, y = 0, z = 0;

            string[] xyz = { preset.x, preset.y, preset.z };
            if (!MapGen.GetDimensions(p, xyz, 0, ref x, ref y, ref z, false))
            {
                return;
            }

            MapGen gen = MapGen.Find(preset.type);
            Level  lvl = MapGen.Generate(p, gen, name, x, y, z, "");

            if (lvl == null)
            {
                return;
            }

            MapGen.SetRealmPerms(p, lvl);
            try {
                lvl.Save(true);
            } finally {
                lvl.Dispose();
                Server.DoGC();
            }
            Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name);
        }
Esempio n. 50
0
        static Level ResizeLevel(Level lvl, int width, int height, int length)
        {
            Level res = new Level(lvl.name, (ushort)width, (ushort)height, (ushort)length);

            res.hasPortals       = lvl.hasPortals;
            res.hasMessageBlocks = lvl.hasMessageBlocks;
            byte[] src = lvl.blocks, dst = res.blocks;

            // Copy blocks in bulk
            width  = Math.Min(lvl.Width, res.Width);
            height = Math.Min(lvl.Height, res.Height);
            length = Math.Min(lvl.Length, res.Length);
            for (int y = 0; y < height; y++)
            {
                for (int z = 0; z < length; z++)
                {
                    int srcI = lvl.Width * (z + y * lvl.Length);
                    int dstI = res.Width * (z + y * res.Length);
                    Buffer.BlockCopy(src, srcI, dst, dstI, width);
                }
            }

            // Copy extended blocks in bulk
            width  = Math.Min(lvl.ChunksX, res.ChunksX);
            height = Math.Min(lvl.ChunksY, res.ChunksY);
            length = Math.Min(lvl.ChunksZ, res.ChunksZ);
            for (int cy = 0; cy < height; cy++)
            {
                for (int cz = 0; cz < length; cz++)
                {
                    for (int cx = 0; cx < width; cx++)
                    {
                        src = lvl.CustomBlocks[(cy * lvl.ChunksZ + cz) * lvl.ChunksX + cx];
                        if (src == null)
                        {
                            continue;
                        }

                        dst = new byte[16 * 16 * 16];
                        res.CustomBlocks[(cy * res.ChunksZ + cz) * res.ChunksX + cx] = dst;
                        Buffer.BlockCopy(src, 0, dst, 0, 16 * 16 * 16);
                    }
                }
            }

            // TODO: This copying is really ugly and probably not 100% right
            res.spawnx = lvl.spawnx; res.spawny = lvl.spawny; res.spawnz = lvl.spawnz;
            res.rotx   = lvl.rotx; res.roty = lvl.roty;

            lock (lvl.saveLock) {
                lvl.Backup(true);

                // Make sure zones are kept
                res.Zones = lvl.Zones;
                lvl.Zones = new VolatileArray <Zone>(false);

                IMapExporter.Formats[0].Write(LevelInfo.MapPath(lvl.name), res);
                lvl.SaveChanges = false;
            }

            res.backedup = true;
            Level.LoadMetadata(res);
            BotsFile.Load(res);
            return(res);
        }
Esempio n. 51
0
 public int GetScoreForLevel(LevelInfo level)
 {
     return(!highScores.ContainsKey(level.Name) ? -1 : highScores[level.Name]);
 }
Esempio n. 52
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 53
0
    void Start()
    {
        //isInteractive = true;
        _instance = this;
        audio = GetComponent<AudioSource>();
        if (currentLevel >= words.Count)
        {
            currentLevel = 0;
            Application.LoadLevel("cps613");
            return;
        }
        currentWord = words[currentLevel];
        pictureSprite.GetComponent<SpriteRenderer>().sprite = pictures[currentLevel];
        tempMask = currentWord.mask;
        if (currentWord.word.Length < 1) return;
        List<char> leftovers = new List<char>();
        for (int i = 0; i < currentWord.word.Length; i++)
        {
            char c = char.ToUpper(currentWord.word[i]);

            LetterScript letterScript = Instantiate(letterPrefab).GetComponent<LetterScript>();
            letterScript.isStatic = true;
            letterScript.letter = c;
            letterScript.ChangeSprite();
            if (start == null)
            {
                size = letterScript.gameObject.GetComponent<SpriteRenderer>().sprite.bounds.size.x;
                float totalLen = (size.Value + padding) * currentWord.word.Length;
                start = -totalLen / 2f + size.Value;
            }
            letterScript.transform.position = new Vector3(start.Value + i * (size.Value + padding), topY, 0);

            bool show = currentWord.mask[i] == '1';
            if (!show)
            {
                leftovers.Add(c);
                var sr = letterScript.GetComponent<SpriteRenderer>();
                sr.color = new Color(0, 0, 0, 0.5f);
                sr.sortingOrder = 1;
                if (currentLevel == 0)
                {
                    fingerDest2 = letterScript.transform.position;
                }
            }
            else
            {
                var sr = letterScript.GetComponent<SpriteRenderer>();
                sr.sortingOrder = 2;
            }
        }
        List<char> deadChars = new List<char>();
        for (int i = 0; i < currentWord.extraLetters; i++)
        {
            char c = 'A';
            do
            {
                c = (char)('A' + Random.Range(0, 26));
            } while (leftovers.Contains(c) || deadChars.Contains(c)); //if leftovers contains every letter, we'll wait for infinity
            deadChars.Add(c);
        }

        foreach (char c in leftovers)
        {
            int index = Random.Range(0, deadChars.Count);
            deadChars.Insert(index, c);
        }

        float start2 = -((size.Value + padding) * deadChars.Count) / 2f + size.Value;
        for (int i = 0; i < deadChars.Count; i++)
        {
            LetterScript letterScript = Instantiate(letterPrefab).GetComponent<LetterScript>();
            letterScript.isStatic = false;
            letterScript.letter = deadChars[i];
            letterScript.ChangeSprite();
            letterScript.transform.position = new Vector3(start2 + i * (size.Value + padding), botY, 0);
            var sr = letterScript.GetComponent<SpriteRenderer>();
            sr.sortingOrder = 2;
            remainingLetters.Add(letterScript);

        }
        if (currentLevel == 0)
        {
            StartCoroutine("AudioPlayer");
        }
        else
        {
            PlayWord();
            isInteractive = true;
        }
    }
Esempio n. 54
0
        public static Warp Create(int x, int y, LevelWarpInfo warpInfo, LevelInfo sourceLevel, LevelInfo targetLevel, Transform parent)
        {
            var offset = new Vector3(warpInfo.offsetX, warpInfo.offsetY);
            var pos    = new Vector3(x, y) * Iso.SubTileCount - new Vector3(2, 2) + offset;

            pos = Iso.MapToWorld(pos);

            var warpObject = new GameObject(targetLevel.levelWarp);

            warpObject.transform.position = pos;
            warpObject.transform.SetParent(parent);
            var warp = warpObject.AddComponent <Warp>();

            warp.sourceLevel   = sourceLevel;
            warp.targetLevel   = targetLevel;
            warp.info          = warpInfo;
            warp.transform     = warpObject.transform;
            warp.selectSize    = new Vector3(warpInfo.selectDX, warpInfo.selectDY) / Iso.pixelsPerUnit;
            warp.selectOffset  = new Vector3(warpInfo.selectX, -warpInfo.selectY) / Iso.pixelsPerUnit;
            warp.selectOffset += new Vector3(warp.selectSize.x, -warp.selectSize.y) / 2;
            warpInfo.instance  = warp;
            return(warp);
        }
 // Use this for initialization
 void Start()
 {
     this._LevelInformations = GameObject.Find("LevelInfo").GetComponent <LevelInfo>();
 }
Esempio n. 56
0
    private void Start()
    {
        bool flag = UnityEngine.Random.Range(0, 5) == 0;

        parentRt = base.transform.parent.parent.GetComponent <RectTransform>();
        float num = UnityEngine.Random.Range(2f, 3f);

        if (flag)
        {
            num = 1.2f;
        }
        icon.localScale = new Vector3(num, num, num);
        speedY          = 0.05f;
        angle           = UnityEngine.Random.Range(-30f, 30f);
        icon.gameObject.SetActive(!flag);
        tile.gameObject.SetActive(flag);
        Color color = image.color;

        color.a     = UnityEngine.Random.Range(0.2f, 0.2f);
        image.color = color;
        text.text   = (((char)(ushort)UnityEngine.Random.Range(65, 90)).ToString() ?? "");
        LevelInfo firstNotCompleateLevel = ELSingleton <LevelsSettings> .Instance.levelSet.GetFirstNotCompleateLevel();

        if (firstNotCompleateLevel.currentWorld >= ELSingleton <LevelsSettings> .Instance.levelSet.worlds.Count)
        {
            firstNotCompleateLevel.currentWorld = ELSingleton <LevelsSettings> .Instance.levelSet.worlds.Count - 1;
        }
        Pack pack = ELSingleton <LevelsSettings> .Instance.levelSet.GetPack(firstNotCompleateLevel);

        int num2 = UnityEngine.Random.Range(0, pack.levels.Count);

        if (pack.levels.Count < 25)
        {
            num2 = 0;
        }
        ELSingleton <IconsManager> .Instance.Load(pack.name);

        Sprite sprite = Sprite.Create(ELSingleton <IconsManager> .Instance.Icon.texture, new Rect(num2 % 5 * 96, num2 / 5 * 96, 96f, 96f), new Vector2(0f, 0f));

        image.sprite = sprite;
        bool flag2 = false;
        int  num3  = 0;

        while (!flag2 && num3 < 10)
        {
            flag2 = true;
            Vector2 vector = new Vector2(UnityEngine.Random.Range((0f - parentRt.sizeDelta.x) / 2f, parentRt.sizeDelta.x / 2f), UnityEngine.Random.Range((0f - parentRt.sizeDelta.y) / 2f, parentRt.sizeDelta.y / 2f));
            Rect    rect   = new Rect(vector.x - icon.sizeDelta.x / 2f * num * 1.25f, vector.y - icon.sizeDelta.y * num * 1.25f, icon.sizeDelta.x * num * 1.25f, icon.sizeDelta.y * num * 1.25f);
            base.transform.localPosition = vector;
            foreach (Rect itemBound in itemBounds)
            {
                if (itemBound.Overlaps(rect))
                {
                    flag2 = false;
                    break;
                }
            }
            if (flag2)
            {
                itemBounds.Add(rect);
            }
            num3++;
        }
        if (num3 >= 10)
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }
    }
Esempio n. 57
0
 public void LoadLevel(LevelInfo level)
 {
     currentLevel = level;
     Application.LoadLevel("Garden");
 }
Esempio n. 58
0
        private static void UpdatePresence()
        {
            m_UpdatePresenceTimer -= Time.unscaledDeltaTime;
            if (m_UpdatePresenceTimer > 0.0f)
            {
                return;
            }
            m_UpdatePresenceTimer = m_UpdatePresenceDelaySeconds;

            PresenceState state  = PresenceState.NUM;
            bool          paused = false;
            LevelInfo     level  = null;

            if (GameManager.m_game_state == GameManager.GameState.NONE)
            {
                state = PresenceState.Starting;
            }
            else if ((GameManager.m_game_state == GameManager.GameState.MENU) && !MenuManager.m_game_paused)
            {
                state = (MenuManager.m_menu_state == MenuState.MP_PRE_MATCH_MENU) ? PresenceState.WaitingForMatch : PresenceState.Menus;
            }
            else
            {
#if !UNITY_XBOXONE
                //Playing something
                paused = MenuManager.m_game_paused;
                level  = GameplayManager.Level;
#endif

                if (GameplayManager.Level.Mission.Type == MissionType.TRAINING)
                {
                    state = PresenceState.Training;
                }
                else if (NetworkManager.IsMultiplayerSceneLoading() || NetworkManager.IsMultiplayerSceneLoaded())
                {
                    state  = PresenceState.Multiplayer;
                    paused = false;
                }
                else if (GameplayManager.IsChallengeMode)
                {
                    state = PresenceState.Challenge;
                }
                else
                {
                    state = PresenceState.Mission;
                }
            }

            Assert.True(state != PresenceState.NUM);

            if ((state == m_prev_state) && (paused == m_prev_paused) && (level == m_prev_level))
            {
                return;
            }
            Debug.Log("Presence: " + state + " " + paused + " " + ((level == null) ? "" : level.DisplayName));

            m_prev_state  = state;
            m_prev_paused = paused;
            m_prev_level  = level;

#if UNITY_XBOXONE
#if !UNITY_EDITOR
            XboxOneRichPresence.SetPresence(state, paused);
#endif
#elif UNITY_PS4
            PS4Manager.SetPresence(state, paused, level);
#else
            if (CloudProvider == CloudProviders.Steam)
            {
                Steam.SetPresence(state, paused, level);
            }
#if !UNITY_STANDALONE_LINUX
            else if (CloudProvider == CloudProviders.Galaxy)
            {
                GogGalaxyManager.SetPresence(state, paused, level);
            }
#endif
#endif
        }
Esempio n. 59
0
 public LevelInfo SerializeLevel()
 {
     LevelInfo x = new LevelInfo();
     x.name=name;
     x.m_bareers=m_bareers;
     x.SelectionPhaseDuration=SelectionPhaseDuration;
     x.SelectionPhaseType=SelectionPhaseType;
     x.MovePhaseDuration=MovePhaseDuration;
     x.NumAreas=NumAreas;
     return x;
 }
Esempio n. 60
0
        public static string GetPresenceString(Platform.PresenceState state, bool paused, LevelInfo level, int lang)
        {
            Assert.True(state != Platform.PresenceState.NUM);

            string paused_or_playing = paused ? m_text_paused[lang] : m_text_playing[lang];
            string level_name        = "";
            string mission_name      = "";

            if (level != null)
            {
                level_name   = level.m_display_name[lang];
                mission_name = level.Mission.m_display_name[lang];
            }

            return(string.Format(m_status_strings[(int)state, lang], paused_or_playing, level_name, mission_name));
        }