Пример #1
0
        private void processControlGroupSelection(KeyCode keyCode, int i)
        {
            string        unitToSelect = SettingsManager.controlGroupSettlers[i];
            ALivingEntity settler      = UnitManager.getInstance().playerUnits.Find(x => x.unitName == unitToSelect);

            if (settler == null || !settler.isAlive())
            {
                SettingsManager.controlGroupSettlers[i] = string.Empty;
                return;
            }

            MonoBehaviour selectedObject = UnitManager.getInstance().controllerObj.GetComponent <ControlPlayer>().selectedObject;

            bool openSettlerWindow = false;

            if (selectedObject != null && selectedObject.gameObject.tag == "ControllableUnit" && AManager <GUIManager> .getInstance().GetComponent <HumanSettlerWindow>().entity == selectedObject)
            {
                openSettlerWindow = true;
            }
            AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().SelectObject(settler.transform, openSettlerWindow);

            if (doubleTapDelayArray[i] > 0 && numberOfTapsArray[i] == 1)
            {
                AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().MoveToPosition(settler.coordinate.world);
            }
            else
            {
                resetDobuleTap(i);
            }
        }
Пример #2
0
    /// <summary>
    /// 界面显示回调
    /// </summary>
    /// <param name="data"></param>
    protected override void OnShow(object data)
    {
        base.OnShow(data);

        AManager.ReqOpenArena();

        //UpdateArenaMain();
    }
Пример #3
0
    static void CreateNewManager(AManager theNewManager)
    {
        GameObject  go = new GameObject(theNewManager.name);
        BaseManager m  = (BaseManager)go.AddComponent(theNewManager.scriptToAdd);

        m.InitManagerForEditor();
        AttachInstanceAndStock(go);
    }
Пример #4
0
        public PackageService()
        {
            AManager manager = new AManager();

            _packageReq  = new PackageRequests(manager);
            _vPackageReq = new VPackageRequests(manager);
            _nugetDL     = new NuGetDownloader();
            _graphData   = new GraphData();
        }
Пример #5
0
        /// <summary>
        /// This function will move through idle settlers forward and backwords depending on the bool
        /// </summary>
        /// <param name="next">Go to the next idle settler or the previous idle settler.</param>
        private void idleSettlerTab(bool next)
        {
            if (idleSettlers.Count == 0)
            {
                return;
            }

            ControlPlayer controlPlayer = AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>();

            MonoBehaviour selectedObject    = UnitManager.getInstance().controllerObj.GetComponent <ControlPlayer>().selectedObject;
            bool          openSettlerWindow = false;

            if (selectedObject != null && selectedObject.gameObject.tag == "ControllableUnit" && AManager <GUIManager> .getInstance().GetComponent <HumanSettlerWindow>().entity == selectedObject)
            {
                openSettlerWindow = true;
            }
            if (!AManager <GUIManager> .getInstance().gameOver)
            {
                if (next)
                {
                    currentIdleSettlerIndex++;                         //go to next settler
                    if (currentIdleSettlerIndex >= idleSettlers.Count) //do we need to go to the begining of hte list?
                    {
                        currentIdleSettlerIndex = 0;
                    }
                    while (!idleSettlers[currentIdleSettlerIndex].isAlive())   //make sure it is not dead, if it is go to the next one.
                    {
                        currentIdleSettlerIndex++;
                        if (currentIdleSettlerIndex >= idleSettlers.Count)
                        {
                            currentIdleSettlerIndex = 0;
                        }
                    }
                }
                else
                {
                    currentIdleSettlerIndex--;       //go to the previous settler
                    if (currentIdleSettlerIndex < 0) //if we are at the begining of the list go to the last
                    {
                        currentIdleSettlerIndex = idleSettlers.Count - 1;
                    }
                    while (!idleSettlers[currentIdleSettlerIndex].isAlive())   //make sure we are not selecting dead settlers
                    {
                        currentIdleSettlerIndex--;
                        if (currentIdleSettlerIndex < 0)
                        {
                            currentIdleSettlerIndex = idleSettlers.Count - 1;
                        }
                    }
                }
            }

            //move to the settler and select him
            AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().MoveToPosition(idleSettlers[currentIdleSettlerIndex].coordinate.world);

            AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().SelectObject(idleSettlers[currentIdleSettlerIndex].transform, openSettlerWindow);
        }
Пример #6
0
        //This function just displays the Gmae Speed GUI at the top right of the screen.
        private void GameSpeedGUI()
        {
            int num  = Screen.width - 120;
            int num2 = 88;

            if (Screen.width > 1520)
            {
                num2 -= 40;
            }
            guiMgr.DrawWindow(new Rect((float)(num - 10), (float)(num2 + 5), 128f, 24f), string.Empty, false, true);

            if (GUI.Button(new Rect((float)(num - 5), (float)(num2 + 4), 26f, 26f), "3x", this.guiMgr.blankButtonStyle))
            {
                AManager <TimeManager> .getInstance().play(3f);

                GUIManager.getInstance().AddTextLine("3x Speed");
            }
            if (GUI.Button(new Rect((float)(num + 27), (float)(num2 + 4), 26f, 26f), "4x", this.guiMgr.blankButtonStyle))
            {
                AManager <TimeManager> .getInstance().play(4f);

                GUIManager.getInstance().AddTextLine("4x Speed");
            }
            if (GUI.Button(new Rect((float)(num + 58), (float)(num2 + 4), 26f, 26f), "5x", this.guiMgr.blankButtonStyle))
            {
                AManager <TimeManager> .getInstance().play(5f);

                GUIManager.getInstance().AddTextLine("5x Speed");
            }
            if (GUI.Button(new Rect((float)(num + 84), (float)(num2 + 4), 26f, 26f), "6x", this.guiMgr.blankButtonStyle))
            {
                AManager <TimeManager> .getInstance().play(6f);

                GUIManager.getInstance().AddTextLine("6x Speed");
            }
            if (Time.timeScale == 3f)
            {
                GUI.DrawTexture(new Rect((float)(num - 8), (float)(num2 + 1), 32f, 32f), this.guiMgr.gameSpeedSelector);
            }
            else
            {
                if (Time.timeScale == 4f)
                {
                    GUI.DrawTexture(new Rect((float)(num + 26), (float)(num2 + 1), 32f, 32f), this.guiMgr.gameSpeedSelector);
                }
                else if (Time.timeScale == 5f)
                {
                    GUI.DrawTexture(new Rect((float)(num + 57), (float)(num2 + 1), 32f, 32f), this.guiMgr.gameSpeedSelector);
                }
                else if (Time.timeScale == 6f)
                {
                    GUI.DrawTexture(new Rect((float)(num + 83), (float)(num2 + 1), 32f, 32f), this.guiMgr.gameSpeedSelector);
                }
            }
        }
Пример #7
0
        //This is called alot less then ongui and can have some model data manipulation in it.
        //This is also were any hotkeys are intercepted.
        void Update()
        {
            if (Input.GetKeyDown(SettingsManager.hotKeys["toggleTripleSpeedHotKey"]))
            {
                if (SettingsManager.boolSettings[(int)Preferences.toggleTripleSpeed] == false)
                {
                    SettingsManager.boolSettings[(int)Preferences.toggleTripleSpeed] = true;
                    AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().DeSelect();

                    AManager <GUIManager> .getInstance().GetComponent <MainMenus>().CloseAll();
                }
                else
                {
                    SettingsManager.boolSettings[(int)Preferences.toggleTripleSpeed] = false;
                }
            }
        }
Пример #8
0
 /// <summary>
 /// 刷新挑战CD
 /// </summary>
 void CDUpdate()
 {
     if (AManager.CD > 0 && AManager.ChallengeTimes != 0)
     {
         m_btn_NowChalleng.gameObject.SetActive(true);
         m_label_NowChalleng_price.gameObject.SetActive(true);
         m_label_Challenge_Time.gameObject.SetActive(true);
         m_label_NowChalleng_price.text = string.Format("{0}", AManager.GetClearCDCost());         //暂定20
         challengIntervalCoroutine      = StartCoroutine(ArenaChallengInterval((int)AManager.CD)); //暂定10分钟
     }
     else
     {
         m_btn_NowChalleng.gameObject.SetActive(false);
         m_label_NowChalleng_price.gameObject.SetActive(false);
         m_label_Challenge_Time.gameObject.SetActive(false);
     }
 }
Пример #9
0
        //This is called alot less then ongui and can have some model data manipulation in it.
        //This is also were any hotkeys are intercepted.
        void Update()
        {
            if (selectSettler && settlerToSelect != null)   //if we are suppose to select a settler and there is a settler to select
            {
                MonoBehaviour selectedObject    = UnitManager.getInstance().controllerObj.GetComponent <ControlPlayer>().selectedObject;
                bool          openSettlerWindow = false;
                if (selectedObject != null && selectedObject.gameObject.tag == "ControllableUnit" && AManager <GUIManager> .getInstance().GetComponent <HumanSettlerWindow>().entity == selectedObject)
                {
                    openSettlerWindow = true;
                }

                AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().MoveToPosition(settlerToSelect.coordinate.world);

                AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().SelectObject(settlerToSelect.transform, openSettlerWindow);

                selectSettler = false;
            }

            if (Input.GetKeyDown(SettingsManager.hotKeys["previousIdleSettler"]))
            {
                idleSettlerTab(false);
            }

            if (Input.GetKeyDown(SettingsManager.hotKeys["nextIdleSettler"]))
            {
                idleSettlerTab(true);
            }

            if (Input.GetKeyDown(SettingsManager.hotKeys["toggleIdleSettlersHotKey"]))
            {
                if (SettingsManager.boolSettings[(int)Preferences.toggleIdleSettlers] == false)
                {
                    SettingsManager.boolSettings[(int)Preferences.toggleIdleSettlers] = true;
                    AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().DeSelect();

                    AManager <GUIManager> .getInstance().GetComponent <MainMenus>().CloseAll();
                }
                else
                {
                    SettingsManager.boolSettings[(int)Preferences.toggleIdleSettlers] = false;
                }
            }
        }
Пример #10
0
    /// <summary>
    /// 清挑战Cd
    /// </summary>
    void CheckAndReqClearCD()
    {
        uint cost = AManager.GetClearCDCost();

        Action yes = delegate
        {
            if (MainPlayerHelper.IsHasEnoughMoney(ClientMoneyType.YuanBao, cost))
            {
                //向服务器请求
                AManager.ReqRefreshCD();
            }
            else
            {
                //元宝不足去充值
                GotoRecharge();
            }
        };

        string des = Tmger.GetLocalFormatText(LocalTextType.Arena_Commond_6, Tmger.GetCurrencyNameByType((GameCmd.MoneyType)ClientMoneyType.YuanBao), "x" + cost);//消耗{0}元宝消除冷却时间

        TipsManager.Instance.ShowTipWindow(TipWindowType.YesNO, des, yes, null, title: Tmger.GetLocalText(LocalTextType.Local_TXT_Tips), okstr: Tmger.GetLocalText(LocalTextType.Local_TXT_Confirm), cancleStr: Tmger.GetLocalText(LocalTextType.Local_TXT_Cancel));
    }
        private Vector3 getRandomPosition()
        {
            int   num  = UnityEngine.Random.Range(1, 5);
            float num2 = 0f;
            float num3 = 0f;

            if (num == 1)
            {
                num3 = 1f;
                num2 = 0f;
            }
            else
            {
                if (num == 2)
                {
                    num3 = -1f;
                    num2 = 0f;
                }
                else
                {
                    if (num == 3)
                    {
                        num3 = 0f;
                        num2 = -1f;
                    }
                    else
                    {
                        if (num == 4)
                        {
                            num3 = 0f;
                            num2 = 1f;
                        }
                    }
                }
            }
            return(new Vector3(AManager <WorldManager> .getInstance().GetEdgePosition() * num2 + num3 * (0.1f + (float)UnityEngine.Random.Range(-256, 257) * 0.1f), 0f, AManager <WorldManager> .getInstance().GetEdgePosition() * num3 + num2 * (0.1f + (float)UnityEngine.Random.Range(-256, 257) * 0.1f)));
        }
        /// <summary>
        /// This function will load the plugin. It will take hte plugin info make sure the file exsits
        /// and then load the dll, find the class that needs to be loaded and then load that class.
        /// There is no checking in place to make sure the plugins do not conflict.
        /// </summary>
        /// <param name="pluginInfo">This is the plugin that will be loaded.</param>
        public static void loadPlugin(PluginInfo pluginInfo)
        {
            if (pluginInfo.isLoaded)
            {
                return;
            }

            pluginInfo.shouldLoadPlugin = true;
            FileInfo info = new FileInfo("./saves/" + pluginInfo.fileName);

            if (info != null && info.Exists == true)   //make sure the file is there
            {
                try {
                    //loading new domains do not work for some reason
                    //pluginInfo.appDomain = AppDomain.CreateDomain("Testdomain");
                    //AssemblyName assemblyName = new AssemblyName();
                    //assemblyName.CodeBase = pluginInfo.fileName;
                    //pluginInfo.assembly = pluginInfo.appDomain.Load(pluginInfo.fileName);

                    pluginInfo.assembly = Assembly.LoadFile("./saves/" + pluginInfo.fileName); //load file
                    if (pluginInfo.assembly != null)
                    {
                        Type[] types = pluginInfo.assembly.GetTypes(); //get all classes out of file
                        for (int i = 0; i < types.Length; i++)
                        {
                            Type type = types[i];
                            if (typeof(IPlugin).IsAssignableFrom(type) && type.IsClass)      //find the one that is a plugin
                            {
                                pluginInfo.plugin = (IPlugin)Activator.CreateInstance(type); //create that class
                            }
                        }
                    }
                    else
                    {
                        GUIWindowModOptions.displayErrorMessage("Assemply is null on load of '" + pluginInfo.fileName + "'");
                        AManager <GUIManager> .getInstance().AddTextLine("Assemply is null on load of '" + pluginInfo.fileName + "'");
                    }
                } catch (Exception ex) {
                    GUIWindowModOptions.displayErrorMessage("Could not load assembly: '" + pluginInfo.fileName + "'");
                    AManager <GUIManager> .getInstance().AddTextLine("Could not load assembly: '" + pluginInfo.fileName + "'");

                    AManager <GUIManager> .getInstance().AddTextLine(" " + ex.Message);

                    pluginInfo.shouldLoadPlugin = false;
                    pluginInfo.isLoaded         = false;
                }

                if (pluginInfo.plugin != null)   //make sure we created the class
                {
                    try {
                        pluginInfo.plugin.OnLoad(); //load hte plugin
                    } catch (Exception ex) {
                        GUIWindowModOptions.displayErrorMessage("Assembly " + pluginInfo.assembly.GetName().Name + " crashed in OnLoad");
                        AManager <GUIManager> .getInstance().AddTextLine("Assembly " + pluginInfo.assembly.GetName().Name + " crashed in OnLoad with exception: " + ex.Message);

                        pluginInfo.shouldLoadPlugin = false;
                        pluginInfo.isLoaded         = false;
                    }

                    try {
                        pluginInfo.plugin.OnEnable(); //enable the plugin
                    } catch (Exception ex) {
                        GUIWindowModOptions.displayErrorMessage("Assembly " + pluginInfo.assembly.GetName().Name + " crashed in OnEnable");
                        AManager <GUIManager> .getInstance().AddTextLine("Assembly " + pluginInfo.assembly.GetName().Name + " crashed in OnEnable with exception: " + ex.Message);

                        pluginInfo.shouldLoadPlugin = false;
                        pluginInfo.isLoaded         = false;
                    }
                    pluginInfo.isLoaded = true;
                }
                else
                {
                    GUIWindowModOptions.displayErrorMessage("Plugin is null");
                    AManager <GUIManager> .getInstance().AddTextLine("Plugin is null");

                    pluginInfo.shouldLoadPlugin = false;
                    pluginInfo.isLoaded         = false;
                }
            }
            else
            {
                GUIWindowModOptions.displayErrorMessage("File name does not exist: '" + pluginInfo.fileName + "'");
                AManager <GUIManager> .getInstance().AddTextLine("File name does not exist: '" + pluginInfo.fileName + "'");

                pluginInfo.shouldLoadPlugin = false;
                pluginInfo.isLoaded         = false;
            }
        }
Пример #13
0
 public void Test()
 {
     AManager am = new AManager();
 }
Пример #14
0
 // Ensure that the instance is destroyed when the game is stopped in the editor.
 void OnApplicationQuit()
 {
     s_Instance = null;
 }
Пример #15
0
    static void Init()
    {
        if (_allManagers == null)
        {
            _allManagers = new List <AManager>();
        }
        if (_allManagersInstance == null)
        {
            _allManagersInstance = new List <GameObject>();
        }


        //************** ADD MANAGER HERE **************//

        // GAME MANAGER
        AManager gameManager = new AManager("Game Manager", typeof(GameManager));

        _allManagers.Add(gameManager);

        // SOUND MANAGER
        AManager soundManager = new AManager("Sound Manager", typeof(SoundManager));

        _allManagers.Add(soundManager);

        // INPUT MANAGER
        AManager inputManager = new AManager("Input Manager", typeof(InputManager));

        _allManagers.Add(inputManager);

        // SCORE MANAGER
        AManager scoreManager = new AManager("Score Manager", typeof(ScoreManager));

        _allManagers.Add(scoreManager);

        // UI MANAGER
        AManager uiManager = new AManager("UI Manager", typeof(UIManager));

        _allManagers.Add(uiManager);

        // SCREENSHAKE MANAGER
        AManager screenShakeManager = new AManager("ScreenShake Manager", typeof(ScreenShakeManager));

        _allManagers.Add(screenShakeManager);

        // PLAYER MANAGER
        AManager playerManager = new AManager("Player Manager", typeof(PlayerManager));

        _allManagers.Add(playerManager);

        // GAMEPAD MANAGER
        AManager gamepadManager = new AManager("Gamepad Manager", typeof(GamepadManager));

        _allManagers.Add(gamepadManager);

        // INFO MANAGER
        AManager infoManager = new AManager("Info Manager", typeof(InfoManager));

        _allManagers.Add(infoManager);

        // QUEST MANAGER
        AManager questManager = new AManager("Quest Manager", typeof(QuestManager));

        _allManagers.Add(questManager);

        // CINEMATIC MANAGER
        AManager cinematicManager = new AManager("Cinematic Manager", typeof(CinematicManager));

        _allManagers.Add(cinematicManager);

        // CAMERA MANAGER
        AManager cameraManager = new AManager("Camera Manager", typeof(CameraManager));

        _allManagers.Add(cameraManager);

        //************** ADD MANAGER HERE **************//


        // Get existing open window or if none, make a new one:
        MasterManager window = (MasterManager)EditorWindow.GetWindow(typeof(MasterManager));

        window.Show();
    }
Пример #16
0
 public UserService(PasswordHasher passwordHasher)
 {
     _aManager       = new AManager();
     _passwordHasher = passwordHasher;
 }
Пример #17
0
 /// <summary>
 /// 换一组
 /// </summary>
 /// <param name="caster"></param>
 void onClick_Btn_change_Btn(GameObject caster)
 {
     AManager.ReqArenaRivalThree();
 }
Пример #18
0
 /// <summary>
 /// 战报
 /// </summary>
 /// <param name="caster"></param>
 void onClick_Btn_report_Btn(GameObject caster)
 {
     AManager.ReqBattlelog();
 }