Example #1
0
 private void Awake()
 {
     instance        = this;
     runes           = new Rune[4];
     RunesDictionary = new Dictionary <RuneEvent, List <Rune> >();
     runePrefabs     = new Dictionary <string, RunePrefab>();
     InitRunePathDictionary();
 }
Example #2
0
 void Awake()
 {
     Singelton        = this;
     runeEvents       = new Dictionary <Type, List <Action <Rune, Action> > >();
     gameRunes        = new List <Rune>();
     currentCallbacks = 0;
     runePump         = new Queue <Rune>();
 }
Example #3
0
    public void SelectionInput(RuneManager.Rune rune, Action action)
    {
        var tInput = ((RuneManager.WaitForSelection) rune);

        if (tInput.controller == this)
        {
            _state = ControllerState.WaitingForSelection;
        }
        action();
    }
Example #4
0
 private void Awake()
 {
     runeManager = RuneManager.instance;
     for (int i = 0; i < Config.setNum; i++)
     {
         if (!File.Exists("set_" + i + ".txt"))
         {
             File.Create("set_" + i + ".txt");
         }
     }
 }
Example #5
0
 public void OnCharacterMove(RuneManager.Rune rune, System.Action action)
 {
     RuneManager.MoveEvent moveEvent = (RuneManager.MoveEvent)rune;
     if(moveEvent.mover.Team !=team)
     {
         if(!spottedEnemies.Contains(moveEvent.mover))
         {
             spottedEnemies.Add(moveEvent.mover);
         }
     }
 }
Example #6
0
 public RuneManager(EntityMyself _myself)
 {
     Instance = this;
     m_myself = _myself;
     //初始化6个符文位
     for (int i = 0; i < BODY_LEN; i++)
     {
         BodyRune brune = new BodyRune();
         brune.posi = i;
         body.Add(brune);
     }
     AddListeners();
 }
Example #7
0
 public RuneManager(EntityMyself _myself)
 {
     Instance = this;
     m_myself = _myself;
     //初始化6个符文位
     for (int i = 0; i < BODY_LEN; i++)
     {
         BodyRune brune = new BodyRune();
         brune.posi = i;
         body.Add(brune);
     }
     AddListeners();
 }
Example #8
0
    void Awake()
    {
        lockNum++;
        station = GetComponentInParent <RuneStation>();

        success += LockManager.CorrectButtonPressed;
        success += delegate { if (!station.correctButtonPressed)
                              {
                                  RuneManager.CorrectbuttonPressed();
                              }
        };
        success += () => station.correctButtonPressed = true;

        failure += () => Alien.AttractAliens(transform.position);
    }
Example #9
0
    void Start()
    {
        //correctColor = RuneManager.RuneKey[stationIndex];
        StationData data = RuneManager.GetRandomRune();

        correctColor = data.runeColor;
        GameObject rune = Instantiate(Resources.Load("Runes/Rune " + (data.runeNum)) as GameObject, Vector3.zero, Quaternion.identity);

        Vector3 scale = rune.transform.localScale;

        rune.transform.SetParent(transform);
        rune.transform.localScale    = scale;
        rune.transform.localPosition = new Vector3(4.47f, -.611f, .204f);
        rune.transform.parent        = null;
        rune.transform.localScale    = scale;
    }
Example #10
0
    // Use this for initialization

    void Awake()
    {
        instance = this;
        runeKey  = new Dictionary <int, RuneStation.Colors>();
        // initialize runekey randomly
        RuneStation.Colors[]      c      = { RuneStation.Colors.Blue, RuneStation.Colors.Red, RuneStation.Colors.NeonGreen, RuneStation.Colors.Purple };
        List <RuneStation.Colors> colors = new List <RuneStation.Colors>(c);
        int i = 0;

        while (i < 4)
        {
            int k = Random.Range(0, colors.Count);
            runeKey[i] = colors[k];
            colors.RemoveAt(k);
            i++;
        }
    }
Example #11
0
 private void CheckElementOnInput()
 {
     RuneManager.PlaceElement(_mousePos, _elementSelector.CurrentElement, true);
 }
Example #12
0
 private void CheckElementOnHover()
 {
     RuneManager.PlaceElement(_mousePos, _elementSelector.CurrentElement, false);
 }
Example #13
0
        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            base.OnEnterWorld();
            LoggerHelper.Info("Avatar name: " + name);
            // 在调用该函数前, 数据已经通过EntityAttach 和 EntityCellAttach 同步完毕
            CreateModel();
            inventoryManager = new InventoryManager(this);
            bodyenhanceManager = new BodyEnhanceManager(this);
            skillManager = new PlayerSkillManager(this);
            battleManger = new PlayerBattleManager(this, skillManager as PlayerSkillManager);

            doorOfBurySystem = new DoorOfBurySystem();
            runeManager = new RuneManager(this);
            towerManager = new TowerManager(this);
            missionManager = new MissionManager(this);
            taskManager = new TaskManager(this, (int)taskMain);
            marketManager = new MarketManager(this);
            friendManager = new FriendManager(this);
            operationSystem = new OperationSystem(this);
            sanctuaryManager = new SanctuaryManager(this);
            arenaManager = new ArenaManager(this);
            dailyEventSystem = new DailyEventSystem(this);
            rankManager = new RankManager(this);
            campaignSystem = new CampaignSystem(this);
            wingManager = new WingManager(this);
            rewardManager = new RewardManager(this);
            occupyTowerSystem = new OccupyTowerSystem(this);

            TipManager.Init();
            DragonMatchManager.Init();
            fumoManager = new FumoManager(this);

            MailManager.Instance.IsMailInfoDirty = true;
            TongManager.Instance.Init();
            GuideSystem.Instance.AddListeners();
            StoryManager.Instance.AddListeners();
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnNormalAttack, NormalAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeStart, PowerChargeStart);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeInterrupt, PowerChargeInterrupt);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeComplete, PowerChargeComplete);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellOneAttack, SpellOneAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellTwoAttack, SpellTwoAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellThreeAttack, SpellThreeAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellXPAttack, SpecialAttack);
            EventDispatcher.AddEventListener<int>(Events.UIBattleEvent.OnSpriteSkill, OnSpriteSkill);

            EventDispatcher.AddEventListener<uint>(Events.GearEvent.Teleport, Teleport);
            EventDispatcher.AddEventListener<uint, int, int, int>(Events.GearEvent.Damage, SetDamage);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, InstanceLoaded);
            EventDispatcher.AddEventListener<ushort>(Events.OtherEvent.MapIdChanged, OnMapChanged);
            EventDispatcher.AddEventListener<ulong>(Events.OtherEvent.Withdraw, Withdraw);
            EventDispatcher.AddEventListener(Events.OtherEvent.DiamondMine, DiamondMine);
            EventDispatcher.AddEventListener(Events.OtherEvent.CheckCharge, CheckCharge);
            EventDispatcher.AddEventListener(Events.OtherEvent.Charge, Charge);

            EventDispatcher.AddEventListener(ON_TASK_GUIDE, TaskGuide);
            EventDispatcher.AddEventListener(ON_END_TASK_GUIDE, EndTaskGuide);
            EventDispatcher.AddEventListener<int, int>(ON_TASK_MISSION, MissionOpen);

            EventDispatcher.AddEventListener(Events.AIEvent.DummyThink, DummyThink);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGBegin, ProcCGBegin);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGEnd, ProcCGEnd);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapBegin, ProcTrapBegin);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapEnd, ProcTrapEnd);
            EventDispatcher.AddEventListener(Events.GearEvent.LiftEnter, ProcLiftEnter);
            EventDispatcher.AddEventListener<int>(Events.GearEvent.PathPointTrigger, PathPointTrigger);
            EventDispatcher.AddEventListener(Events.DirecterEvent.DirActive, DirActive);

            EventDispatcher.AddEventListener<int>(Events.EnergyEvent.BuyEnergy, BuyEnergy);
            EventDispatcher.AddEventListener(ON_VIP_REAL_STATE, OnVIPRealState);

            EventDispatcher.AddEventListener<int>(Events.DiamondToGoldEvent.GoldMetallurgy, GoldMetallurgy);

            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.AFFECTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.OUTPUTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.MOVEUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.NORMALATTACK, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.PLAYERINFOBGUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener("MainUIControllStickPressed", OnBattleBtnPressed);

            EventDispatcher.AddEventListener<Vector3>(Events.GearEvent.CrockBroken, CrockBroken);
            EventDispatcher.AddEventListener<bool, bool, Vector3>(Events.GearEvent.ChestBroken, ChestBroken);

            EventDispatcher.AddEventListener<GameObject, Vector3, float>(MogoMotor.ON_MOVE_TO_FALSE, OnMoveToFalse);
            EventDispatcher.AddEventListener(Events.OtherEvent.BossDie, BossDie);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, SetCampControl);

            timerID = TimerHeap.AddTimer<bool>(1000, 100, SyncPos, true);
            checkDmgID = TimerHeap.AddTimer(0, 1000, CheckDmgBase);
            syncHpTimerID = TimerHeap.AddTimer(10000, 5000, SyncHp);
            skillFailoverTimer = TimerHeap.AddTimer(1000, 3000, SkillFailover);
            TimerHeap.AddTimer(5000, 0, GetServerTickReq);
            //rateTimer = TimerHeap.AddTimer(1000, 3000, CheckRate);
            CheckCharge();
            GetWingBag();
            MogoTime.Instance.InitTimeFromServer();

            MogoUIManager.Instance.LoadUIResources();
            TimerHeap.AddTimer(500, 0, EventDispatcher.TriggerEvent, Events.RuneEvent.GetBodyRunes);
            TimerHeap.AddTimer(500, 0, marketManager.GiftRecordReq);

            if (IsNewPlayer)
            {
                CurMissionID = 10100;
                CurMissionLevel = 1;

                missionManager.EnterMissionReq(CurMissionID, CurMissionLevel);
            }


            if (PlatformSdkManager.Instance)
                TimerHeap.AddTimer(1000, 60000, PlatformSdkManager.Instance.OnSetupNotification);
        }
Example #14
0
 void Awake()
 {
     Instance = this;
 }
Example #15
0
        private void OnChampSelectSessionUpdate(object sender, LeagueEvent e)
        {
            // exit if no actions (usually when leaving champ select)
            // or auto champ select not enabled
            if (!e.Data["actions"].HasValues || !autoChampSelect)
            {
                return;
            }

            WriteSafe("formdebug", e.Data.ToString());

            JToken bans        = e.Data["bans"];
            var    ourBans     = bans["myTeamBans"];
            var    theirBans   = bans["theirTeamBans"];
            int    localCellId = Convert.ToInt32(e.Data["localPlayerCellId"]);
            int    roleID      = 0;

            // empty bans array is "[]". we only want to parse bans if there are any
            if (ourBans.ToString().Length > 2)
            {
                ParseBans(ourBans);
            }
            if (theirBans.ToString().Length > 2)
            {
                ParseBans(theirBans);
            }

            JToken actionsTop = e.Data["actions"];
            JToken myTeamTop  = e.Data["myTeam"];

            for (int i = 0; i < myTeamTop.Count(); i++)
            {
                var curPlayer = myTeamTop.ElementAt(i);
                int curCellId = Convert.ToInt32(curPlayer["cellId"]);

                if (localCellId == curCellId)
                {
                    string role = curPlayer["assignedPosition"].ToString().ToLower();
                    switch (role)
                    {
                    case "top":     // top
                        roleID = 0;
                        break;

                    case "jungle":     // jg
                        roleID = 1;
                        break;

                    case "middle":     // mid
                        roleID = 2;
                        break;

                    case "bottom":     // adc
                        roleID = 3;
                        break;

                    case "utility":     // support
                        roleID = 4;
                        break;

                    default:
                        roleID = 5;
                        break;
                    }
                }
            }

            // iterate through each action (we have to do this becaused 1 action
            // is generated for each player at the same time meaning the last action
            // is only your action if you are last pick)
            for (int i = actionsTop.Count() - 1; i >= 0; i--)
            {
                var curAction = actionsTop.ElementAt(i).First;

                int    curCellId = Convert.ToInt32(curAction["actorCellId"]);
                int    actionId  = Convert.ToInt32(curAction["id"]);
                bool   myTurn    = Convert.ToBoolean(curAction["isInProgress"]);
                string type      = curAction["type"].ToString();

                // current cell belongs to us and hasn't
                if (curCellId == localCellId && myTurn && !HandledActionIDs.Contains(curCellId))
                {
                    HandledActionIDs.Add(curCellId);

                    if (type == "pick")
                    {
                        int[]    currentPrefs = GetChampionPrefsByRoleID(roleID);
                        string[] currentRunes = GetRunesByRoleID(roleID);

                        // automatically pick based on preferred list
                        for (int j = 0; j < PrefPoolSize; j++)
                        {
                            if (currentPrefs[j] != -1 && !UnavailableChampsID.Contains(currentPrefs[j]))
                            {
                                // lock in based on order of prefernce
                                string str = "{\"actorCellId\": " + curCellId + ", \"championId\":" + currentPrefs[j] + ", \"completed\": true, \"id\": " + actionId + ", \"type\": \"string\"}";
                                API.client.MakeApiRequest(HttpMethod.Patch, "/lol-champ-select/v1/session/actions/" + actionId, str);

                                // select runes
                                RuneManager runeManager = new RuneManager(API.client);
                                var         allPages    = runeManager.GetRunePages();
                                RunePage    autoPage    = null;

                                // find page named "auto"
                                foreach (RunePage p in allPages)
                                {
                                    if (p.Name == "auto")
                                    {
                                        autoPage = p;
                                        break;
                                    }
                                }
                                if (autoPage != null) // if page named "auto" is found
                                {
                                    // delete it
                                    API.client.MakeApiRequest(HttpMethod.Delete, "/lol-perks/v1/pages/" + autoPage.Id);
                                }

                                // convert runes string to int array
                                // right side is runes, left side is tree ids (-)
                                string primaryIdstr   = currentRunes[j].Split('-')[0].Split(',')[0];
                                int    primaryId      = Convert.ToInt32(primaryIdstr);
                                string secondaryIdstr = currentRunes[j].Split('-')[0].Split(',')[1];
                                int    secondaryId    = Convert.ToInt32(secondaryIdstr);

                                string[] splitRunes       = currentRunes[j].Split('-')[1].Split(',');
                                int[]    selectedRunesArr = new int[9];
                                for (int k = 0; k < splitRunes.Length; k++)
                                {
                                    selectedRunesArr[k] = Convert.ToInt32(splitRunes[k]);
                                }

                                RunePage newPage = new RunePage()
                                {
                                    IsActive        = true,
                                    IsCurrentPage   = true,
                                    Name            = "auto",
                                    PrimaryTreeId   = primaryId,
                                    SelectedRunes   = selectedRunesArr,
                                    SecondaryTreeId = secondaryId,
                                };

                                // create new rune page with runes chosen in form
                                API.client.MakeApiRequest(HttpMethod.Post, "/lol-perks/v1/pages/", newPage);

                                break;
                            }
                        }
                    }
                    else if (type == "ban")
                    {
                        // automatically ban based on preferred list
                        for (int j = 0; j < PreferredBans.Length; j++)
                        {
                            if (PreferredBans[j] != -1 && !UnavailableChampsID.Contains(PreferredBans[j]))
                            {
                                // lock in based on order of prefernce
                                string str = "{\"actorCellId\": " + curCellId + ", \"championId\":" + PreferredBans[j] + ", \"completed\": true, \"id\": " + actionId + ", \"type\": \"string\"}";
                                API.client.MakeApiRequest(HttpMethod.Patch, "/lol-champ-select/v1/session/actions/" + actionId, str);
                                break;
                            } //if
                        }     //for
                    }         // else if
                }             // if
            }                 // for
        }                     //OnChampSelectSessionUpdate
Example #16
0
 private void Awake()
 {
     runeManager = RuneManager.instance;
     fileManager = FileManager.instance;
 }
Example #17
0
 void OnTriggerEnter(Collider other)
 {
     RuneManager.ClearDict();
     endingCanvas.SetActive(true);
 }