Inheritance: MonoBehaviour
    void Awake()
    {
        mainController = GameObject.Find("Main").GetComponent<MainController>();
        for (int i = 0; i < 25; i++)
        {
            Vector2 position;
            if (i % 4 == 0)
            {
                position = new Vector2(Random.Range(2, 5), Random.Range(-5, 5));
            }
            else if (i % 4 == 1)
            {
                position = new Vector2(Random.Range(-2, -5), Random.Range(-5, 5));
            }
            else if (i % 4 == 2)
            {
                position = new Vector2(Random.Range(-5, 5), Random.Range(-2, -5));
            }
            else
            {
                position = new Vector2(Random.Range(-5, 5), Random.Range(2, 5));
            }

            StupidGruntController clone = (StupidGruntController)Instantiate(stupidGrunt, transform.position, Quaternion.identity);
            clone.player = player;
            clone.transform.position = position;
        }

        StartCoroutine(startWait());
    }
示例#2
0
文件: Menu.cs 项目: georgex1/rednit
	// Use this for initialization
	void Start () {
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		MenuUImagen.GetComponent<Image>().sprite = GMS.spriteSquareFromFile( GMS.userData.foto );
		MenuUNombre.GetComponent<Text>().text = GMS.userData.nombre;
	}
示例#3
0
	void Start () {
		isPopup = false;
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		FB.Init(SetInit, OnHideUnity);
	}
示例#4
0
    // -----------------------------------------------------------------------------------------
    // Protected mono methods
    // -----------------------------------------------------------------------------------------
    protected void Awake()
    {
        // Keep this alive between scene changes
        DontDestroyOnLoad(gameObject);

        // Setup the singleton
        singleton = this;

        // Setup array of UpdateDelegates
        UpdateDelegates = new UpdateDelegate[(int)SceneState.Count];

        // Setting up each element in UpdateDelegates
        UpdateDelegates[(int)SceneState.Reset] = UpdateSceneReset;
        UpdateDelegates[(int)SceneState.Preload] = UpdateScenePreload;
        UpdateDelegates[(int)SceneState.Load] = UpdateSceneLoad;
        UpdateDelegates[(int)SceneState.Unload] = UpdateSceneUnload;
        UpdateDelegates[(int)SceneState.Postload] = UpdateScenePostload;
        UpdateDelegates[(int)SceneState.Ready] = UpdateSceneReady;
        UpdateDelegates[(int)SceneState.Run] = UpdateSceneRun;

        // Setup loading screen
        LoadingScreen.enabled = IsLoadingScreenActive;

        if (StartingSceneName != string.Empty)
            m_NextSceneName = StartingSceneName;
        m_SceneState = SceneState.Reset;
    }
示例#5
0
 void Awake()
 {
     if( instance == null ){
         instance = this;
     }
     Cursor.visible = false;
 }
示例#6
0
    //sets scene to main menu by default
    public void Awake()
    {
        //keep alive
        DontDestroyOnLoad(gameObject);
        _mainController = this;

        _updateDelegates = new UpdateDelegate[(int)SceneState.Count];

        _updateDelegates[(int)SceneState.Reset] = SceneStateReset;
        _updateDelegates[(int)SceneState.Preload] = SceneStatePreload;
        _updateDelegates[(int)SceneState.Load] = SceneStateLoad;
        _updateDelegates[(int)SceneState.Unload] = SceneStateUnload;
        _updateDelegates[(int)SceneState.PostLoad] = ScreenStatePostLoad;
        _updateDelegates[(int)SceneState.Ready] = ScreenStateReady;
        _updateDelegates[(int)SceneState.Run] = ScreenStateRun;

        _nextSceneName = "MainMenu";

        //testing event messaging system
        Messenger.AddListener<string>("Scene change",Test);
        Messenger.MarkAsPermanent("Scene change"); // <-- persists through scene changes
        Messenger.Broadcast("Scene change", _nextSceneName);
        //oh yeah... that's how I like it.

        _currentSceneState = SceneState.Reset;
    }
示例#7
0
 static void Main(string[] args)
 {
     View view = (View) new MainView();
     Model model = new MyModel();
     Controller controller = new MainController();
     try
     {
         model = (MyModel)Activator.CreateInstance(Type.GetType("MrRobot.CLASS"));
         model.AttachObserver(view);
     }
     catch (Exception e)
     {
         model = new MyModel();
         model.AttachObserver(view);
     }
     finally
     {
         controller.AddModel((MyModel)model);
     }
     controller.ActionPerformed(MainController.WELCOME);
     while (Console.ReadKey(true).Key != ConsoleKey.Escape)
     {
         controller.ActionPerformed(MainController.KEYPRESS);
     }
     controller.ActionPerformed(MainController.GOODBYE);
     Console.ReadKey();
 }
示例#8
0
文件: home.cs 项目: georgex1/rednit
	// Use this for initialization
	void Start () {
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		GMS.db.OpenDB(GMS.dbName);

		ArrayList result = GMS.db.BasicQueryArray ("select usuarios_id, personas_id, aceptado, nombre, email, edad, sexo, ciudad, foto, descripcion from amigos_usuarios where aceptado = '0' ");
		GMS.db.CloseDB();

		GameObject OptionDefault = GameObject.Find("DDItems/PanelMask/PanelScroll/Option");

		if (result.Count > 0) {

			MSG_sinsolicitudes.SetActive(false);
			
			foreach (string[] row_ in result) {

				AmigoData amigoData = new AmigoData();
				amigoData.populateUser(row_);

				GameObject clone = Instantiate(OptionDefault, OptionDefault.transform.position, OptionDefault.transform.rotation) as GameObject;
				clone.transform.SetParent(OptionDefault.transform.parent);
				clone.transform.localScale = new Vector3(1, 1, 1);

				clone.transform.Find("PerfilMask/AmigoImagen").GetComponent<Image>().sprite = GMS.spriteSquareFromFile( amigoData.foto );
				clone.transform.Find("Panel/Panel/AmigoNombre").GetComponent<Text>().text = amigoData.nombre;
				clone.transform.Find("Panel/Panel/AmigoEdad").GetComponent<Text>().text = amigoData.edad;
				//clone.transform.Find("Panel/Panel/AmigoCiudad").GetComponent<Text>().text = amigoData.ciudad;

				clone.name = "opcion-" + amigoData.id;
			}

		} 
		Destroy (OptionDefault);
	}
 public OSRICSaveLoadData(OSRICEngine _engine, MainController _mainCon)
 {
     engine = _engine;
     mainCon = _mainCon;
     VerifySaveFile();
     //		JSONCharacterList = new JSONObject(JSONObject.Type.ARRAY);
     LoadCharactersFromSaveFile();
 }
	// Use this for initialization
	void Start () {
		generarDias ();
		generarMeses ();
		generarAnios ();

		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();
	}
        public static void Stop()
        {
            _rootController.Dispose();
            _rootScope.Dispose();

            _rootController = null;
            _rootScope = null;
        }
示例#12
0
 public static void Main(string[] args)
 {
     Application.Initialize ();
     MainController mainController = new MainController (args);
     mainController.Start ();
     mainController.AllWidgetsAreClosed += HandleAllWidgetsAreClosed;
     Application.Run ();
 }
示例#13
0
        public frmMain()
        {
            InitializeComponent();

            m_MainController = MainController.GetController();
            this.LoadFilterCombo();
            this.LoadInitialImage();
        }
示例#14
0
    protected void Awake()
    {
        mainController = this;
        currentScene = "";
        nextScene = "";

        screenRect = new Rect(0, 0, Screen.width, Screen.height);
        progressRect = new Rect(16, Screen.height - 32, Screen.width - 32, 16);
    }
示例#15
0
文件: buscar.cs 项目: georgex1/rednit
	// Use this for initialization
	void Start () {

		hasOne = false;
	
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		GMS.donwloadinGallery = false;

		string fbFriendsString = "'0'";
		if (GMS.userData.fbFriends != null && GMS.userData.busco_en_face == "SI") {
			fbFriendsString = String.Join(",", GMS.userData.fbFriends.ToArray());
		}

		GMS.db.OpenDB(GMS.dbName);
		string buscarQuery = "select id, nombre, edad, sexo, foto, descripcion from personas where visto = '0' AND id NOT IN " +
			"( select personas_id from amigos_usuarios where usuarios_id = '" + GMS.userData.id + "' ) AND fbid NOT IN ( " + fbFriendsString + " ) ";

		ArrayList result = GMS.db.BasicQueryArray (buscarQuery);

		/*ArrayList result = GMS.db.BasicQueryArray ("select id, nombre, edad, sexo, ciudad, foto from personas where visto = '0' ");*/
		GMS.db.CloseDB();

		Debug.Log (buscarQuery);
		Debug.Log ("total personas: " + result.Count);

		if (result.Count > 0) {

			foreach (string[] row_ in result) {

				if (GMS.checkImageExists(row_[4])) {
					hasOne = true;
					actualPersona = row_[0].ToString();
					PersonaNombre.text = row_[1];
					PersonaEdad.text = row_[2];
					//PersonaCiudad.text = row_[4];
					PersonaFoto.sprite = GMS.spriteSquareFromFile(row_[4]);

					PersonaDescripcion.text = row_[5];
				}
			}

			if(result.Count < 3){
				GMS.download_personas ();
			}

			GMS.actualizando = false;

			if(!hasOne){
				NoPersonas();
			}
		} else {
			NoPersonas();
		}


	}
示例#16
0
        /// <summary>
        /// Starts handling research orders when this "invisible app" "showes up" (funny, isn't it?)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Shown(object sender, EventArgs e)
        {
            //initialize main controller
            mainController = new MainController();

            //start main controller research handling loop in separate thread
            mainThread = new Thread(new ThreadStart(mainController.mainLoop));
            mainThread.Start();
        }
示例#17
0
        public Form1()
        {
            InitializeComponent();

            dataGridView1.SelectionChanged += new EventHandler(dataGridView1_SelectionChanged);
            UpdateUI();

            _controller = new MainController();
            _controller.SetForm(this);
        }
        internal ItemController(MainController mainController)
        {
            this.mainController = mainController;

            this.itemDetailsController = new ItemDetailsController(mainController);

            this.mappedItems = new List<Item>();

            LoadAllItems();
        }
示例#19
0
    void Awake()
    {
        DontDestroyOnLoad(transform.gameObject);
        if (instance)
            Destroy(gameObject);
        instance = this;
        domainsRect = new Rect(Screen.width - 250, Screen.height - 200, 250, 500);
        sitesRect = new Rect(0, Screen.height/2 - 200, 250, 500);

        Application.LoadLevel(1);
    }
示例#20
0
    public void OnPointerClick(PointerEventData eventData)
    {
        //		iTween.MoveAdd( Circle, new Vector3(588, 0, 0), 180f );

        //		UnityChan = GameObject.Find ("unitychan");
        //		UnityChanAnim = UnityChan.GetComponent<Animator>();
        //		UnityChanAnim.SetBool ("Next", true);

        MainController = GameObject.Find("Camera").GetComponent<MainController>();;
        MainController.Movie();
        this.gameObject.SetActive(false);
    }
示例#21
0
    private void Start()
	{
        mainController = MainController.Instance;
        if (mainController)
        {
            mainController.DisplayIsUpdating(false);
            foreach (string c in mainController.commands)
            {
                commands.Add(c);
            }
        }
    }
	void Start()
	{
		Debug.Log ("start notif controller");
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		string config_alerts = PlayerPrefs.GetString ("config_alerts");
		Debug.Log ("notificaciones activadas: " + config_alerts);
		NPBinding.NotificationService.RegisterNotificationTypes (m_notificationType);
		//if (config_alerts == "true") {
			NPBinding.NotificationService.RegisterForRemoteNotifications ();
		//}
	}
示例#23
0
	void Start() {
		newAdressFlag = false;
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();
		if(loadOnStart) Refresh();	


		Debug.Log ("Distancia guardada del usuario: " + GMS.userData.busco_distancia);
		if (GMS.userData.busco_distancia != "0" || GMS.userData.busco_distancia != "" ) {
			km.text = GMS.userData.busco_distancia;
			slider.value = float.Parse(GMS.userData.busco_distancia);
		} 


}
示例#24
0
	protected void OnDestroy ()
	{
		// Clean up all the updateDelegates
		if (updateDelegates != null) {
			for (int i = 0; i < (int)SceneState.Count; i++) {
				updateDelegates [i] = null;
			}
			updateDelegates = null;
		}

		// Clean up the singleton instance
		if (mainController != null) {
			mainController = null;
		}
	}
示例#25
0
文件: chat.cs 项目: georgex1/rednit
	// Use this for initialization
	void Start () {
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		string chatGroup = GMS.amigoData.chat_group;

		sender = GMS.userData.nombre/* + "-" + GMS.userData.id*/;
		sc = new SimChat(chatGroup, gameObject.GetComponent<MonoBehaviour>(), sender);
		
		sc.continueCheckMessages();
		sc.setReceiveFunction(receiveMessage1);

		chatNombre.text = GMS.amigoData.nombre;
		chatImage.sprite = GMS.spriteFromFile (GMS.amigoData.foto);
	}
示例#26
0
	// Use this for initialization
	void Start () {
		//amigoData = new UserData();
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();
		
		string amigoId = PlayerPrefs.GetString ("chatUserId");

		chatImage.sprite = GMS.spriteSquareFromFile ( GMS.amigoData.foto );
		chatNombre.text = GMS.amigoData.nombre;
		
		/*GMS.db.OpenDB("millasperrunas.db");
		ArrayList result = GMS.db.BasicQueryArray ("select familia.id, familia.email, familia.nombre, familia.foto, perros_usuarios.chat_group from familia " +
		                                           "inner join perros_usuarios on perros_usuarios.usuarios_id = familia.id where familia.id = "+amigoId+" ");
		GMS.db.CloseDB ();*/
		
		//Debug.Log ("amigo id: " + ((string[])result [0]) [0]);
		
		/*amigoData.id = GMS.amigoData.id;
		amigoData.email = GMS.amigoData.email;
		amigoData.nombre = GMS.amigoData.nombre;
		amigoData.foto =  GMS.amigoData.foto;*/
		
		amigoImage = GMS.spriteSquareFromFile ( GMS.amigoData.foto );
		userImage = GMS.spriteSquareFromFile ( GMS.userData.foto );
		
		Application.runInBackground = true;
		//string chatGroup = ((string[])result [0]) [4];
		
		string chatGroup = GMS.amigoData.chat_group;
		
		/*Debug.Log ("chat group vals: " + ((string[])result [0]) [4] + " | " + GMS.perro.chat_group);
		Debug.Log ("chat group: " + chatGroup);*/
		
		sender = GMS.userData.nombre;
		sc = new SimChat(chatGroup, gameObject.GetComponent<MonoBehaviour>(), sender);
		
		sc.continueCheckMessages();
		sc.setReceiveFunction(receiveMessage1);
		
		chatYo.SetActive (false);
		chatEl.SetActive (false);
		//displayChat2 ();
		
		//myScrollRect.verticalNormalizedPosition = 0.5f;
		yChatCount = chatYo.transform.position.y;
		//RectTransform rectTransform = GetComponent<RectTransform>();
		//rectTransform.pivot = new Vector2(transform.pivot.x, 0);
	}
示例#27
0
	// Use this for initialization
	void Start () {

		//get usuario id
		actualPersona = PlayerPrefs.GetString ("usuarios_id");
		
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();
		
		GMS.donwloadinGallery = false;
		
		GMS.db.OpenDB(GMS.dbName);
		string buscarQuery = "select id, nombre, edad, sexo, ciudad, foto, descripcion from personas where id = '"+actualPersona+"'";
		ArrayList result = GMS.db.BasicQueryArray (buscarQuery);

		GMS.db.CloseDB();
		
		if (result.Count > 0) {//verificar si esta en personas

			PersonaNombre.text = ((string[])result [0]) [1];
			PersonaEdad.text = ((string[])result [0]) [2];
			//PersonaCiudad.text = ((string[])result [0]) [4];
			PersonaDescripcion.text = ((string[])result [0]) [6];

			getGallery ();

		} else {
			//verificar si esta en amigos_usuarios
			buscarQuery = "select personas_id, nombre, edad, sexo, ciudad, foto, descripcion from amigos_usuarios where personas_id = '"+actualPersona+"'";
			Debug.Log(buscarQuery);
			GMS.db.OpenDB(GMS.dbName);
			result = GMS.db.BasicQueryArray (buscarQuery);
			GMS.db.CloseDB();

			if (result.Count > 0) {//verificar si esta en personas
				
				PersonaNombre.text = ((string[])result [0]) [1];
				PersonaEdad.text = ((string[])result [0]) [2];
				//PersonaCiudad.text = ((string[])result [0]) [4];
				PersonaDescripcion.text = ((string[])result [0]) [6];
				
				getGallery ();
				
			} else {
				Application.LoadLevel("home");
			}
		}
		
	}
 private void Awake()
 {
     if (_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
         //DontDestroyOnLoad(this);
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if (this != _instance)
             Destroy(this.gameObject);
     }
 }
示例#29
0
 /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
 /// <param term='commandName'>The name of the command to execute.</param>
 /// <param term='executeOption'>Describes how the command should be run.</param>
 /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
 /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
 /// <param term='handled'>Informs the caller if the command was handled or not.</param>
 /// <seealso class='Exec' />
 public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
 {
     handled = false;
     if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
     {
         if(commandName == "Migrator.Connect.Migrator")
         {
             Main main = new Main();
             MainController controller = new MainController(new WinFormsResponsiveHelper(ConcurrencyMode.Modal), main);
             controller.AppObj = this._applicationObject as DTE;
             controller.RetrieveProjects();
             main.Show();
             handled = true;
             return;
         }
     }
 }
示例#30
0
        public void ExecuteInstructionTest01()
        {
            MainController target = new MainController(null);
            string instruction = "mind land1 schweiz red";
            target.ExecuteInstruction(instruction);

            // TODO check!!!

            instruction = "north land2 frankreich blue false";
            target.ExecuteInstruction(instruction);

            instruction = "south land3 italien green false";
            target.ExecuteInstruction(instruction);

            instruction = "forget land2";
            target.ExecuteInstruction(instruction);
        }
示例#31
0
 public Mainform(MainController controller)
 {
     InitializeComponent();
     this.controller = controller;
 }
示例#32
0
        private async void ControlFun()
        {
            Configuration.Save();
            if (State == State.Waiting || State == State.Stopped)
            {
                // 服务器、模式 需选择
                if (!(ServerComboBox.SelectedItem is Server server))
                {
                    MessageBoxX.Show(i18N.Translate("Please select a server first"));
                    return;
                }

                if (!(ModeComboBox.SelectedItem is Models.Mode mode))
                {
                    MessageBoxX.Show(i18N.Translate("Please select a mode first"));
                    return;
                }

                // 清除模式搜索框文本选择
                ModeComboBox.Select(0, 0);

                State = State.Starting;

                if (await MainController.Start(server, mode))
                {
                    State = State.Started;
                    _     = Task.Run(() => { Bandwidth.NetTraffic(server, mode); });
                    // 如果勾选启动后最小化
                    if (Global.Settings.MinimizeWhenStarted)
                    {
                        WindowState = FormWindowState.Minimized;

                        if (_isFirstCloseWindow)
                        {
                            // 显示提示语
                            NotifyTip(i18N.Translate("Oxygen VPN is now minimized to the notification bar, double click this icon to restore."));
                            _isFirstCloseWindow = false;
                        }

                        Hide();
                    }

                    if (Global.Settings.StartedTcping)
                    {
                        // 自动检测延迟
                        _ = Task.Run(() => {
                            while (State == State.Started)
                            {
                                server.Test();
                                // 重绘 ServerComboBox
                                ServerComboBox.Invalidate();

                                Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
                            }
                        });
                    }
                }
                else
                {
                    State = State.Stopped;
                    StatusText(i18N.Translate("Start failed"));
                }
            }
            else
            {
                // 停止
                State = State.Stopping;
                await MainController.Stop();

                State = State.Stopped;
                _     = Task.Run(TestServer);
            }
        }
示例#33
0
 public void SetMainController(MainController mc)
 {
     _MainController = mc;
 }
示例#34
0
        /// <summary>
        /// Call wcc buildcache over the uncooked directories
        /// IN: \\CollisionCache, cooked\\Mods\\mod\\cook.db, OUT: packed\\Mods\\mod
        /// </summary>
        /// <param name="cachetype"></param>
        /// <param name="packmod"></param>
        /// <param name="packdlc"></param>
        /// <returns></returns>
        public static async Task <int> GenerateCache(EBundleType cachetype, bool packmod, bool packdlc)
        {
            //const string db_dlcfiles = "db_dlcfiles";
            //const string db_dlctextures = "db_dlctextures";
            //const string db_modfiles = "db_modfiles";
            //const string db_modtextures = "db_modtextures";

            string dlc_files_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), "db_dlcfiles");
            string mod_files_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), "db_modfiles");
            string moddbfile    = Path.Combine(mod_files_db, "cook.db");
            string dlcdbfile    = Path.Combine(dlc_files_db, "cook.db");
            string modbasedir   = ActiveMod.ModUncookedDirectory;
            string dlcbasedir   = MainController.Get().Configuration.DepotPath;


            cachebuilder cbuilder = cachebuilder.textures;
            string       filename = "";

            switch (cachetype)
            {
            case EBundleType.TextureCache:
            {
                cbuilder = cachebuilder.textures;
                filename = "texture.cache";
            }
            break;

            case EBundleType.CollisionCache:
            {
                cbuilder = cachebuilder.physics;
                filename = "collision.cache";
            }
            break;

            default:
                throw new NotImplementedException();
            }

            int finished = 1;

            if (packmod)
            {
                finished *= await Task.Run(() => GenerateCacheInternal(ActiveMod.PackedModDirectory, moddbfile, modbasedir));
            }
            if (packdlc)
            {
                finished *= await Task.Run(() => GenerateCacheInternal(ActiveMod.PackedDlcDirectory, dlcdbfile, dlcbasedir, true));
            }

            return(finished == 0 ? 0 : 1);

            async Task <int> GenerateCacheInternal(string packDir, string dbfile, string basedir, bool dlc = false)
            {
                string type = dlc ? "Dlc" : "Mod";

                try
                {
                    // check if a cook.db exists for that
                    if (File.Exists(dbfile))
                    {
                        Logger.LogString($"======== Generating {type} {cachetype} cache ======== \n", Logtype.Important);
                        //MainController.Get().ProjectStatus = $"Generating {type} {cachetype} cache";

                        var buildcache = new Wcc_lite.buildcache()
                        {
                            Platform = platform.pc,
                            builder  = cbuilder,
                            basedir  = basedir,
                            DataBase = dbfile,
                            Out      = $"{packDir}\\{filename}"
                        };
                        return(await Task.Run(() => MainController.Get().WccHelper.RunCommand(buildcache)));
                    }
                    else
                    {
                        return(-1);
                    }
                }
                catch (DirectoryNotFoundException)
                {
                    Logger.LogString($"{type} {cachetype} folder not found. {type} {cachetype} won't be generated. \n", Logtype.Important);
                    return(-1);
                }
                catch (Exception ex)
                {
                    Logger.LogString(ex.ToString() + "\n", Logtype.Error);
                    return(0);
                }
            }
        }
示例#35
0
        public NewAccountForm(MainController controller)
        {
            InitializeComponent();

            _controller = controller;
        }
        private async void BtnClientes_Click(object sender, EventArgs e)
        {
            MensajeEspera.ShowWait("Cargando reporte...");

            MainController main     = MainController.GetInstance();
            int            id_cobro = main.Id_cobro;

            DataTable dtClientes = new DataTable("Clientes");

            dtClientes.Columns.Add("Id_cliente", typeof(int));
            dtClientes.Columns.Add("Nombre_cliente", typeof(string));
            dtClientes.Columns.Add("Celular_cliente", typeof(string));
            dtClientes.Columns.Add("Referencia_articulo", typeof(string));
            dtClientes.Columns.Add("Saldo_restante", typeof(string));
            dtClientes.Columns.Add("Venta_total", typeof(string));
            dtClientes.Columns.Add("Fecha_venta", typeof(string));
            dtClientes.Columns.Add("Fecha_ultimo_pago", typeof(string));

            int      id_cliente          = 0;
            string   nombre_cliente      = string.Empty;
            string   celular_cliente     = string.Empty;
            string   referencia_articulo = string.Empty;
            decimal  saldo_restante      = 0;
            decimal  total_venta         = 0;
            DateTime fecha_venta         = DateTime.Now;
            decimal  suma_ventas         = 0;
            decimal  suma_saldos         = 0;
            DateTime fecha_ultimo_pago   = DateTime.Now;

            var(rpta, dtVentas) =
                await NVentas.BuscarVentas("ID COBRO ACTIVO", id_cobro.ToString());

            if (dtVentas != null)
            {
                foreach (DataRow row in dtVentas.Rows)
                {
                    Ventas venta = new Ventas(row);
                    id_cliente      = venta.Id_cliente;
                    nombre_cliente  = venta.Cliente.NombreCompleto;
                    celular_cliente = venta.Cliente.Celular;
                    total_venta     = venta.Total_venta;
                    fecha_venta     = venta.Fecha_venta;
                    suma_ventas    += venta.Total_venta;

                    if (!venta.Tipo_venta.Equals("MIGRACION"))
                    {
                        var(dtDetalleArticulos, rptaBusqueda) =
                            await NArticulos.BuscarArticulos("ID VENTA", venta.Id_venta.ToString());

                        if (dtDetalleArticulos != null)
                        {
                            StringBuilder referencias = new StringBuilder();
                            referencias.Append(dtDetalleArticulos.Rows.Count + " referencias: ");
                            foreach (DataRow rowArt in dtDetalleArticulos.Rows)
                            {
                                Detalle_articulos_venta detalle = new Detalle_articulos_venta(rowArt);
                                referencias.Append("(" + detalle.Articulo.Id_articulo + ") ");
                                referencias.Append(detalle.Articulo.Referencia_articulo + " - ");
                            }
                            referencia_articulo = referencias.ToString();
                        }
                    }

                    //Buscar los agendamientos de cada venta para ver su saldo restante
                    var(rpta1, dtAgendamientos) = await NAgendamiento_cobros.BuscarAgendamientos("ID VENTA", venta.Id_venta.ToString());

                    if (dtAgendamientos != null)
                    {
                        Agendamiento_cobros ag = new Agendamiento_cobros(dtAgendamientos.Rows[0]);
                        saldo_restante    = ag.Saldo_restante;
                        suma_saldos      += ag.Saldo_restante;
                        fecha_ultimo_pago = ag.Fecha_cobro;
                    }

                    DataRow newRow = dtClientes.NewRow();
                    newRow["Id_cliente"]          = id_cliente;
                    newRow["Nombre_cliente"]      = nombre_cliente;
                    newRow["Celular_cliente"]     = celular_cliente;
                    newRow["Referencia_articulo"] = referencia_articulo;
                    newRow["Saldo_restante"]      = saldo_restante.ToString("C");
                    newRow["Venta_total"]         = total_venta.ToString("C");
                    newRow["Fecha_venta"]         = fecha_venta.ToString("dd-MM-yyyy");
                    newRow["Fecha_ultimo_pago"]   = fecha_ultimo_pago.ToString("dd-MM-yyyy");
                    dtClientes.Rows.Add(newRow);
                }

                if (dtClientes.Rows.Count > 0)
                {
                    MensajeEspera.CloseForm();
                    //Enviar informe
                    FrmReporteClientes frmReporteClientes = new FrmReporteClientes
                    {
                        WindowState  = FormWindowState.Maximized,
                        dtClientes   = dtClientes,
                        Total_saldos = suma_saldos.ToString("C"),
                        Total_ventas = suma_ventas.ToString("C"),
                    };
                    frmReporteClientes.Show();
                }
                else
                {
                    Mensajes.MensajeInformacion("No se encontraron clientes", "Entendido");
                }
            }
            else
            {
                Mensajes.MensajeInformacion("No se encontraron clientes", "Entendido");
            }

            MensajeEspera.CloseForm();
        }
示例#37
0
        /// <summary>
        /// Cooks Files in the ModProject's folders (Bunde, TextureCache etc...)
        /// </summary>
        /// <returns></returns>
        public static async Task <int> Cook()
        {
            var    cfg          = MainController.Get().Configuration;
            string dlc_files_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), db_dlcfiles);
            //string dlc_tex_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), db_dlctextures);
            string mod_files_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), db_modfiles);
            //string mod_tex_db = Path.Combine(Path.GetFullPath(MainController.Get().ActiveMod.ProjectDirectory), db_modtextures);

            int finished = 1;

            // Cook Mod files



            if (Directory.Exists(ActiveMod.ModUncookedDirectory) && Directory.GetFiles(ActiveMod.ModUncookedDirectory, "*", SearchOption.AllDirectories).Any() &&
                !string.IsNullOrEmpty(ActiveMod.CookedModDirectory))
            {
                finished *= await Task.Run(() => CookInternal(ActiveMod.ModUncookedDirectory, ActiveMod.CookedModDirectory));

                if (!string.IsNullOrEmpty(ActiveMod.CookedModDirectory))
                {
                    var moddb = new FileInfo(Path.Combine(ActiveMod.CookedModDirectory, "cook.db"));
                    if (moddb.Exists)
                    {
                        moddb.MoveTo(Path.Combine(mod_files_db, "cook.db"));
                    }
                }
            }

            // Cook DLC files
            if (Directory.Exists(ActiveMod.DlcUncookedDirectory) && Directory.GetFiles(ActiveMod.DlcUncookedDirectory, "*", SearchOption.AllDirectories).Any() &&
                !string.IsNullOrEmpty(ActiveMod.CookedDlcDirectory))
            {
                finished *= await Task.Run(() => CookInternal(ActiveMod.DlcUncookedDirectory, ActiveMod.CookedDlcDirectory, true));

                if (!string.IsNullOrEmpty(ActiveMod.CookedDlcDirectory))
                {
                    var dlcdb = new FileInfo(Path.Combine(ActiveMod.CookedDlcDirectory, "cook.db"));
                    if (dlcdb.Exists)
                    {
                        dlcdb.MoveTo(Path.Combine(dlc_files_db, "cook.db"));
                    }
                }
            }


            return(finished == 0 ? 0 : 1);

            async Task <int> CookInternal(string dir_uncooked, string dir_cooked, bool dlc = false)
            {
                string type = dlc ? "Dlc" : "Mod";

                try
                {
                    if (Directory.Exists(dir_uncooked) && Directory.GetFiles(dir_uncooked, "*", SearchOption.AllDirectories).Any())
                    {
                        Logger.LogString($"======== Cooking {type} ======== \n", Logtype.Important);
                        //MainController.Get().ProjectStatus = $"Cooking {type}";

                        if (!Directory.Exists(dir_cooked))
                        {
                            Directory.CreateDirectory(dir_cooked);
                        }

                        Wcc_lite.cook cook = new Wcc_lite.cook()
                        {
                            Platform = platform.pc,
                            outdir   = dir_cooked,
                        };


                        if (dlc)
                        {
                            cook.trimdir = $"dlc\\{ActiveMod.GetDlcName()}";
                            var seeddir = Path.Combine(ActiveMod.ProjectDirectory, @"cooked", $"seed_dlc{ActiveMod.Name}.files");
                            cook.seed = seeddir;
                        }
                        else
                        {
                            cook.mod     = dir_uncooked;
                            cook.basedir = dir_uncooked; //cfg.DepotPath?
                        }

                        return(await Task.Run(() => MainController.Get().WccHelper.RunCommand(cook)));
                    }
                    else
                    {
                        return(-1);
                    }
                }
                catch (DirectoryNotFoundException)
                {
                    Logger.LogString($"{type} folder not found. {type} won't be cooked. \n", Logtype.Important);
                    return(-1);
                }
                catch (Exception ex)
                {
                    Logger.LogString(ex.ToString() + "\n", Logtype.Error);
                    return(0);
                }
            }
        }
示例#38
0
 internal WordCloudController(MainController mainController)
 {
     this.mainController = mainController;
 }
示例#39
0
 public WhatIsIt(MainController controller)
 {
     Controller = controller;
 }
示例#40
0
 // Start is called before the first frame update
 void Start()
 {
     crosshairs     = GameObject.Find("CrossHairs 1");
     mainController = GameObject.Find("GameManager").GetComponent <MainController>();
     Debug.Assert(mainController != null);
 }
示例#41
0
    static void  ReadCallback(IAsyncResult ar)
    {
        Socket handler   = (Socket)ar.AsyncState;
        int    bytesRead = handler.EndReceive(ar);

        if (bytesRead != 0)
        {
            string data = Encoding.UTF8.GetString(buffer, 0, bytesRead);

            string[] command = data.Split('|');

            switch (command[0])
            {
            case "RoomID":
                print("RoomIDAccepted");
                MainController.LoadScene();
                break;

            case "Answer":
                mainController.UnTrueAnswersofOpponent++;
                mainController.ChangeStateofMarkers();
                mainController.Log.text += "Answer";
                break;

            case "RepeatCreateRoom":
                mainController.Log.text        += "RepeatCreateRoom";
                mainController.AllowButtonClick = true;
                mainController.timer            = 10f;
                mainController.TimerStart       = true;
                break;

            case "GameResult":
                mainController.CalculateGameResult(command[1]);
                break;

            case "Disconnect":

                SendData("Disconnect|");
                mainController.TimerStart = false;
                mainController.Disconnected();
                mainController.Log.text = "LoadScene 0";
                mainController.InvokeLeftRoom();
                socket = null;
                break;

            case "GetMoney":



                Money.money = int.Parse(command[1]);
                print("Money Sendeed");
                Camera.main.GetComponent <Money>().TextMoney.enabled = true;
                break;

            case "Music":

                mainController.SetTrueAnswer(mainController.AnswersText, command[2]);

                mainController.SetUnTrueAnswer(mainController.AnswersText, command[3]);
                mainController.SetUnTrueAnswer(mainController.AnswersText, command[4]);

                break;

            default:
                mainController.Log.text += data;
                break;
            }
        }
        handler.BeginReceive(buffer, 0, buffer.Length, 0, ReadCallback, handler);
    }
示例#42
0
 void Start()
 {
     controller = GameObject.FindWithTag("GameController").GetComponent <MainController>();
 }
示例#43
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.name == "Ball" || collision.gameObject.name == "Bullet")
        {
            if (collision.gameObject.name == "Bullet")
            {
                Destroy(collision.gameObject);
            }

            aguante--;
            if (collision.gameObject.name == "Ball")
            {
                if (collision.gameObject.GetComponent <BallScript>().Destroyer)
                {
                    aguante -= 6;
                }
            }
            if (aguante <= 0)
            {
                int index = SelectPower();
                if (index > 0)
                {
                    crearPower(index);
                }
                MainController.puntuacion += puntos;
                MainController.nbricks--;
                if (MainController.nbricks == 0)
                {
                    if (MainController.world == 1)
                    {
                        MainController.mapa2();
                        MainController.world = 2;
                    }
                    else
                    {
                        MainController.mapa3();
                        MainController.world = 3;
                    }
                }
                Destroy(gameObject);
            }
            else
            {
                if (type == BlockEnum.Azul)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/02-Breakout-Tiles");
                }
                if (type == BlockEnum.Amarillo)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/14-Breakout-Tiles");
                }
                if (type == BlockEnum.Cafe)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/20-Breakout-Tiles");
                }
                if (type == BlockEnum.Celeste)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/12-Breakout-Tiles");
                }
                if (type == BlockEnum.Gris)
                {
                    aguante       = int.MaxValue;
                    render.sprite = Resources.Load <Sprite>("Sprites/18-Breakout-Tiles");
                }
                if (type == BlockEnum.Marron)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/10-Breakout-Tiles");
                }
                if (type == BlockEnum.Morado)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/06-Breakout-Tiles");
                }
                if (type == BlockEnum.Rojo)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/08-Breakout-Tiles");
                }
                if (type == BlockEnum.Verde_claro)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/12-Breakout-Tiles");
                }
                if (type == BlockEnum.Verde_oscuro)
                {
                    render.sprite = Resources.Load <Sprite>("Sprites/16-Breakout-Tiles");
                }
            }
        }
    }
示例#44
0
        /// <summary>
        /// Adds all file dependencies (cr2w imports) to a specified folder
        /// retaining relative paths
        /// </summary>
        /// <param name="importfilepath"></param>
        /// <param name="recursive"></param>
        /// <param name="silent"></param>
        /// <param name="alternateOutDirectory"></param>
        /// <returns></returns>
        public static async Task AddAllImports(string importfilepath, bool recursive = false, bool silent = false, string alternateOutDirectory = "", bool logonly = false)
        {
            if (!File.Exists(importfilepath))
            {
                return;
            }

            string          relativepath  = "";
            bool            isDLC         = false;
            EProjectFolders projectFolder = EProjectFolders.Uncooked;

            if (string.IsNullOrWhiteSpace(alternateOutDirectory))
            {
                (relativepath, isDLC, projectFolder) = importfilepath.GetModRelativePath(ActiveMod.FileDirectory);
            }
            else
            {
                relativepath = importfilepath.Substring(alternateOutDirectory.Length + 1);
            }

            List <CR2WImportWrapper> importslist = new List <CR2WImportWrapper>();
            List <CR2WBufferWrapper> bufferlist  = new List <CR2WBufferWrapper>();
            bool hasinternalBuffer;

            using (var fs = new FileStream(importfilepath, FileMode.Open, FileAccess.Read))
                using (var reader = new BinaryReader(fs))
                {
                    var cr2w = new CR2WFile();
                    (importslist, hasinternalBuffer, bufferlist) = cr2w.ReadImportsAndBuffers(reader);
                }

            bool success = true;

            // add imports
            foreach (CR2WImportWrapper import in importslist)
            {
                var filename = Path.GetFileName(import.DepotPathStr);
                if (logonly)
                {
                    MainController.LogString(filename, Logtype.Important);
                }

                var path = UnbundleFile(import.DepotPathStr, isDLC, projectFolder, EBundleType.Bundle, alternateOutDirectory, false, silent);
                if (string.IsNullOrWhiteSpace(path))
                {
                    Logger.LogString($"Did not unbundle {filename}, import is missing.", Logtype.Error);
                }
                else
                {
                    // recursively add all 1st order dependencies :Gp:
                    if (recursive)
                    {
                        AddAllImports(path, true, silent, alternateOutDirectory, logonly);
                    }
                }
            }

            // add buffers
            if (hasinternalBuffer)
            {
                Logger.LogString($"{Path.GetFileName(importfilepath)} has internal buffers. If you need external buffers, unbundle them manually.", Logtype.Important);
            }
            else
            {
                // unbundle external buffers
                foreach (CR2WBufferWrapper buffer in bufferlist)
                {
                    var    index      = buffer.Buffer.index;
                    string bufferpath = $"{relativepath}.{index}.buffer";
                    var    bufferName = $"{Path.GetFileName(relativepath)}.{index}.buffer";

                    var path = UnbundleFile(bufferpath, isDLC, projectFolder, EBundleType.Bundle, alternateOutDirectory, false, silent);
                    if (string.IsNullOrWhiteSpace(path))
                    {
                        Logger.LogString($"Did not unbundle {bufferName}, import is missing.", Logtype.Error);
                    }
                }
            }

            if (success && !silent)
            {
                Logger.LogString($"Succesfully imported all dependencies.", Logtype.Success);
            }
        }
 public scorecard_form()
 {
     mainController = new MainController();
     InitializeComponent();
     updateComboBox();
 }
示例#46
0
        /// <summary>
        /// Exports an existing file in the ModProject (w2mesh, redcloth) to the modProject
        /// </summary>
        /// <param name="fullpath"></param>
        /// <returns></returns>
        public static async Task ExportFileToMod(string fullpath)
        {
            string workDir = Path.GetFullPath($"{MainController.WorkDir}_export");

            if (!Directory.Exists(workDir))
            {
                Directory.CreateDirectory(workDir);
            }
            Directory.Delete(workDir, true);

            // check if physical file exists
            if (!File.Exists(fullpath))
            {
                Logger.LogString($"File to export does not exist {fullpath}.", Logtype.Error);
                return;
            }

            // check if the extension matches an exportable format
            string      importedExtension = Path.GetExtension(fullpath).TrimStart('.');
            EImportable exportedExtension;

            try
            {
                exportedExtension = REDTypes.ExportExtensionToRawExtension((EExportable)Enum.Parse(typeof(EExportable), importedExtension));
            }
            catch (Exception ex)
            {
                Logger.LogString($"Not an exportable filetype: {importedExtension}.", Logtype.Error);
                return;
            }

            // get relative path
            (string relativePath, bool isDLC, EProjectFolders projectFolder) = fullpath.GetModRelativePath(ActiveMod.FileDirectory);
            var exportpath = isDLC
                ? Path.Combine(ActiveMod.RawDirectory, "DLC", relativePath)
                : Path.Combine(ActiveMod.RawDirectory, "Mod", relativePath);

            exportpath = Path.ChangeExtension(exportpath, exportedExtension.ToString());

            // add all imports to

            //string workDir = "";                                            // add to mod
            //string workDir = MainController.Get().Configuration.DepotPath;  // r4depot

            AddAllImports(fullpath, true, true, workDir);

            // copy the w2mesh and all imports to the depot
            var depotInfo    = new FileInfo(Path.Combine(workDir, relativePath));
            var uncookedInfo = new FileInfo(fullpath);

            uncookedInfo.CopyToAndCreate(depotInfo.FullName, true);



            // export with wcc_lite
            if (!string.IsNullOrEmpty(relativePath) && !string.IsNullOrEmpty(exportpath))
            {
                // uncook the folder
                var export = new Wcc_lite.export()
                {
                    File  = relativePath,
                    Out   = exportpath,
                    Depot = workDir
                };
                await Task.Run(() => MainController.Get().WccHelper.RunCommand(export));

                if (File.Exists(exportpath))
                {
                    Logger.LogString($"Successfully exported {relativePath}.", Logtype.Success);
                }
                else
                {
                    Logger.LogString($"Did not export {relativePath}.", Logtype.Error);
                }
            }
        }
示例#47
0
 // Start is called before the first frame update
 void Start()
 {
     mainController = MainController.Get();
     gameController = GameObject.Find("GameController").GetComponent <GameController>();
 }
 protected void Start()
 {
     m_mainController = FindObjectOfType <MainController>();
     InitializeController();
 }
示例#49
0
 ReportViewModel()
 {
     mainc = new MainController();
 }
示例#50
0
 // Use this for initialization
 public void initialize(MainController controller)
 {
     this.controller = controller;
 }
示例#51
0
        /// <summary>
        /// Unbundles a file with the given relativepath from either the Game or the Mod BundleManager
        /// and adds it to the depot, optionally copying to the project
        /// </summary>
        /// <param name="relativePath"></param>
        /// <param name="isDLC"></param>
        /// <param name="projectFolder"></param>
        /// <param name="bundleType"></param>
        /// <param name="alternateOutDirectory"></param>
        /// <param name="loadmods"></param>
        /// <param name="silent"></param>
        /// <returns></returns>
        public static string UnbundleFile(string relativePath, bool isDLC, EProjectFolders projectFolder, EBundleType bundleType = EBundleType.Bundle, string alternateOutDirectory = "", bool loadmods = false, bool silent = false)
        {
            string extension = Path.GetExtension(relativePath);
            string filename  = Path.GetFileName(relativePath);

            // Jato said not to add textures to an fbx
            // so I am keeping meshes violet :)
            //if (extension == ".xbm" && bundleType == EBundleType.Bundle)
            //{
            //    //var uncookTask = Task.Run(() => UncookFileToPath(relativePath, isDLC, alternateOutDirectory));
            //    //Task.WaitAll(uncookTask);
            //    //return relativePath;
            //    UnbundleFile(relativePath, isDLC, projectFolder, EBundleType.TextureCache, alternateOutDirectory,
            //        loadmods, silent);
            //}
            IWitcherArchiveManager manager = MainController.Get().GetManagers(loadmods).FirstOrDefault(_ => _.TypeName == bundleType);

            if (manager != null && manager.Items.Any(x => x.Value.Any(y => y.Name == relativePath)))
            {
                var archives = manager.FileList
                               .Where(x => x.Name == relativePath)
                               .Select(y => new KeyValuePair <string, IWitcherFile>(y.Bundle.ArchiveAbsolutePath, y))
                               .ToList();


                // Extract
                try
                {
                    // if more than one archive get the last
                    var archive = archives.Last().Value;

                    string newpath = "";
                    if (string.IsNullOrWhiteSpace(alternateOutDirectory))
                    {
                        switch (projectFolder)
                        {
                        case EProjectFolders.Cooked:
                            newpath = Path.Combine(isDLC
                                    ? ActiveMod.DlcCookedDirectory
                                    : ActiveMod.ModCookedDirectory, relativePath);
                            break;

                        case EProjectFolders.Uncooked:
                            newpath = Path.Combine(isDLC
                                    ? ActiveMod.DlcUncookedDirectory
                                    : ActiveMod.ModUncookedDirectory, relativePath);
                            break;

                        case EProjectFolders.Raw:
                        default:
                            break;
                        }
                    }
                    else
                    {
                        newpath = Path.Combine(alternateOutDirectory, relativePath);
                    }

                    if (string.IsNullOrWhiteSpace(newpath))
                    {
                        return("");
                    }

                    if (!(extension == ".xbm" && bundleType == EBundleType.Bundle) || !File.Exists(newpath))
                    {
                        string extractedfile = archive.Extract(new BundleFileExtractArgs(newpath, MainController.Get().Configuration.UncookExtension));
                        if (!silent)
                        {
                            Logger.LogString($"Succesfully unbundled {filename}.", Logtype.Success);
                        }
                    }
                    else
                    if (!silent)
                    {
                        Logger.LogString($"File already exists in mod project: {filename}.", Logtype.Success);
                    }
                    return(newpath);
                }
                catch (Exception ex)
                {
                    Logger.LogString(ex.ToString(), Logtype.Error);
                    return("");
                }
            }

            return("");
        }
示例#52
0
    private void AddItem(int no, FileInfo file, Transform parent)
    {
        string[] info  = file.Name.Split(splitString, System.StringSplitOptions.RemoveEmptyEntries);
        string   scale = "100";

        if (info.Length >= 3)
        {
            scale = info[2];
        }
        GameObject item = Instantiate(Item) as GameObject;

        item.name = file.Name;
        item.transform.SetParent(parent);

        InputField scaleInputField = item.transform.Find("Scale/InputField").GetComponent <InputField>();

        scaleInputField.text = scale;
        scaleInputField.onEndEdit.AddListener(delegate(string result)
        {
            string scale_result = result.Trim();
            if (scale_result.Length == 0)
            {
                scale_result = "100";
            }
            scaleInputField.text = scale_result;
            string new_filename  = info[0] + "__" + info[1] + "__" + scale_result + file.Extension;
            System.IO.File.Move(file.FullName, subjectDir.FullName + new_filename);
            itemFiles = subjectDir.GetFiles().Where(f => allowedExtensions.Contains(f.Extension.ToLower())).OrderBy(f => f.Name).ToArray();
            item.name = new_filename;
        });
        item.transform.Find("Index/No").GetComponent <Text>().text = ("" + no).PadLeft(2, '0');
        item.transform.Find("DeleteButton").GetComponent <Button>().onClick.AddListener(delegate()
        {
            ConfirmController.SetOnConfirm(DeleteFile, item.name);
            confirmController.gameObject.SetActive(true);
        });
        item.transform.Find("ForwardButton").GetComponent <Button>().onClick.AddListener(delegate()
        {
            SwapItems(item.transform.GetSiblingIndex(), item.transform.GetSiblingIndex() - 1, parent, subjectDir.FullName);
        });
        item.transform.Find("BackwardButton").GetComponent <Button>().onClick.AddListener(delegate()
        {
            SwapItems(item.transform.GetSiblingIndex(), item.transform.GetSiblingIndex() + 1, parent, subjectDir.FullName);
        });

        Transform image = item.transform.Find("Mask/Image");

        Texture2D SpriteTexture = MainController.LoadTexture(file.FullName);
        int       width         = SpriteTexture.width;
        int       height        = SpriteTexture.height;

        Sprite sprite = Sprite.Create(SpriteTexture, new Rect(0, 0, width, height), new Vector2(0.5f, 0.5f), 100);

        image.GetComponent <Image>().sprite = sprite;
        RectTransform rt         = image.GetComponent <RectTransform>();
        int           new_width  = 320;
        int           new_height = (int)(1f * new_width * height / width);

        if (new_height < 240)
        {
            new_height = 240;
            new_width  = (int)(1f * new_height * width / height);
        }
        rt.sizeDelta = new Vector2(new_width, new_height);

        parent.GetComponent <ContentSizeFitter>().enabled = true;
        parent.GetComponent <ContentSizeFitter>().SetLayoutVertical();
        LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)parent);
        parent.GetComponent <ContentSizeFitter>().enabled = false;
    }
示例#53
0
        /// <summary>
        /// Uncooks a single file to a temp directory
        /// </summary>
        /// <param name="relativePath"></param>
        /// <param name="newpath"></param>
        /// <param name="indir"></param>
        /// <returns></returns>
        public static async Task <int> UncookFileToPath(string basedir, string relativePath, bool isDLC, string alternateOutDirectory = "")
        {
            #region Unbundle relative file directory to temp dir
            // create temporary uncooked directory
            string outdir = Path.GetFullPath(MainController.WorkDir);
            if (Directory.Exists(outdir))
            {
                Directory.Delete(outdir, true);
            }
            Directory.CreateDirectory(outdir);

            var di = new DirectoryInfo(outdir);

            // try get uncook extension from settings
            imageformat imgfmt = imageformat.tga;
            try
            {
                imgfmt = (imageformat)Enum.Parse(typeof(imageformat), MainController.Get().Configuration.UncookExtension.ToString());
            }
            catch (Exception)
            {
            }

            string relativeParentDir = Path.GetDirectoryName(relativePath);

            // uncook the folder with wcc
            // check if mod or vanilla file
            var indir = isDLC
                ? Path.GetFullPath(MainController.Get().Configuration.GameDlcDir)
                : Path.GetFullPath(MainController.Get().Configuration.GameContentDir);
            if (basedir.Contains(Path.GetFullPath(MainController.Get().Configuration.GameModDir)))
            {
                indir = basedir;
            }


            var wccuncook = new Wcc_lite.uncook()
            {
                InputDirectory  = indir,
                OutputDirectory = outdir,
                TargetDirectory = relativeParentDir,
                Imgfmt          = imgfmt,
                //UncookExtensions = Path.GetExtension(newpath).TrimStart('.'),
            };
            await Task.Run(() => MainController.Get().WccHelper.RunCommand(wccuncook));

            #endregion

            #region Move file to outdir
            // move uncooked file to mod project
            string newpath = "";
            // if an alternative dir is set, move there
            // otherwise move to mod
            if (string.IsNullOrWhiteSpace(alternateOutDirectory))
            {
                newpath = isDLC
                    ? Path.Combine(ActiveMod.DlcUncookedDirectory, $"dlc{ActiveMod.Name}", relativePath)
                    : Path.Combine(ActiveMod.ModUncookedDirectory, relativePath);
            }
            else
            {
                newpath = Path.Combine(alternateOutDirectory, relativePath);
            }

            if (string.IsNullOrWhiteSpace(newpath))
            {
                return(0);
            }

            int addedFilesCount = 0;
            var fis             = di.GetFiles("*", SearchOption.AllDirectories);
            foreach (var f in fis)
            {
                if (f.Name != Path.GetFileName(relativePath))
                {
                    continue;
                }

                try
                {
                    if (File.Exists(newpath))
                    {
                        File.Delete(newpath);
                    }

                    f.CopyToAndCreate(newpath);

                    addedFilesCount++;
                }
                catch (Exception ex)
                {
                    Logger.LogString($"Unable to move uncooked file to ModProject, perhaps a file of that name is cuurrently open in Wkit.", Logtype.Error);
                }
            }
            #endregion


            // Logging
            Logger.LogString($"Moved {addedFilesCount} files to project.", Logtype.Important);
            if (addedFilesCount > 0)
            {
                Logger.LogString($"Successfully uncooked {addedFilesCount} files.", Logtype.Success);
            }
            else
            {
                Logger.LogString($"Wcc_lite is unable to uncook this file.", Logtype.Error);
            }


            return(addedFilesCount);
        }
示例#54
0
 public void ClearSession()
 {
     MainController.Clear();
 }
示例#55
0
 public void ConfirmInput()
 {
     MainController.getInput(CurrentInput);
 }
示例#56
0
    void OnEnable()
    {
#if USE_DOTWEEN
        LocScript = ((MainController)target);
#endif

        m_Background                   = new GUIStyle();
        m_Background.margin            = new RectOffset(2, 2, 2, 2);
        m_Background.normal.background = MakeTex(new Color(0.3f, 0.3f, 0.3f, 0.5f));

#if USE_ADMOB && SUPPORTED_PLATFORM
        InterstitialAdUnitId = serializedObject.FindProperty("InterstitialAdUnitId");
        AdFrequency          = serializedObject.FindProperty("AdFrequency");
        TestMode             = serializedObject.FindProperty("TestMode");
        AdmobTestID          = serializedObject.FindProperty("AdmobTestID");
#endif

#if (USE_ONESIGNAL && SUPPORTED_PLATFORM)
        AppId = serializedObject.FindProperty("AppId");
#endif

#if USE_DOTWEEN
        SplashScreen     = serializedObject.FindProperty("SplashScreen");
        MenuCanvas       = serializedObject.FindProperty("MenuCanvas");
        GameCanvas       = serializedObject.FindProperty("GameCanvas");
        PauseCanvas      = serializedObject.FindProperty("PauseCanvas");
        GameOverCanvas   = serializedObject.FindProperty("GameOverCanvas");
        ReviewCanvas     = serializedObject.FindProperty("ReviewCanvas");
        ReviewTestCanvas = serializedObject.FindProperty("ReviewTestCanvas");

        RetrySplashButton   = serializedObject.FindProperty("RetrySplashButton");
        SplashScreenLoading = serializedObject.FindProperty("SplashScreenLoading");

        QuestionTypes      = serializedObject.FindProperty("QuestionTypes");
        QuizMode           = serializedObject.FindProperty("QuizMode");
        SoundImage         = serializedObject.FindProperty("SoundImage");
        ActiveSoundImage   = serializedObject.FindProperty("ActiveSoundImage");
        VibrateImage       = serializedObject.FindProperty("VibrateImage");
        ActiveVibrateImage = serializedObject.FindProperty("ActiveVibrateImage");
        MenuHandler        = serializedObject.FindProperty("MenuHandler");
        Confirmation       = serializedObject.FindProperty("Confirmation");


        ImageLoadingAnimation = serializedObject.FindProperty("ImageLoadingAnimation");
        ImageErrorPanel       = serializedObject.FindProperty("ImageErrorPanel");
        QuestionDisplay       = serializedObject.FindProperty("QuestionDisplay");
        AnswerList            = serializedObject.FindProperty("AnswerList");
        ImageDisplay          = serializedObject.FindProperty("ImageDisplay");
        ResultDisplay         = serializedObject.FindProperty("ResultDisplay");
        QuizCounter           = serializedObject.FindProperty("QuizCounter");
        QuitPanel             = serializedObject.FindProperty("QuitPanel");
        ReturnPanel           = serializedObject.FindProperty("ReturnPanel");
        StarButton            = serializedObject.FindProperty("StarButton");
        ActiveStar            = serializedObject.FindProperty("ActiveStar");
        InactiveStar          = serializedObject.FindProperty("InactiveStar");

        GameOverResult     = serializedObject.FindProperty("GameOverResult");
        GameOverTip        = serializedObject.FindProperty("GameOverTip");
        PointsText         = serializedObject.FindProperty("PointsText");
        BonusPointsText    = serializedObject.FindProperty("BonusPointsText");
        GameOverPercentage = serializedObject.FindProperty("GameOverPercentage");
        GameOverCircle     = serializedObject.FindProperty("GameOverCircle");

        Mode            = serializedObject.FindProperty("Mode");
        OnlinePath      = serializedObject.FindProperty("OnlinePath");
        OfflinePath     = serializedObject.FindProperty("OfflinePath");
        OfflinePathFree = serializedObject.FindProperty("OfflinePathFree");
        FreeVersion     = serializedObject.FindProperty("FreeVersion");
        EnableShuffle   = serializedObject.FindProperty("EnableShuffle");
        TimeOut         = serializedObject.FindProperty("TimeOut");
        QuestionCount   = serializedObject.FindProperty("QuestionCount");
        PointsPerAnswer = serializedObject.FindProperty("PointsPerAnswer");
        TimeBonusPoints = serializedObject.FindProperty("TimeBonusPoints");
        TimerAmount     = serializedObject.FindProperty("TimerAmount");
        CorrectColor    = serializedObject.FindProperty("CorrectColor");
        FailColor       = serializedObject.FindProperty("FailColor");
        ButtonColor     = serializedObject.FindProperty("ButtonColor");
        CorrectSound    = serializedObject.FindProperty("CorrectSound");
        FailSound       = serializedObject.FindProperty("FailSound");
        RedToggle       = serializedObject.FindProperty("RedToggle");
        GreenToggle     = serializedObject.FindProperty("GreenToggle");
        Avatars         = serializedObject.FindProperty("Avatars");
        EnablePausing   = serializedObject.FindProperty("EnablePausing");

        GameQuestions    = serializedObject.FindProperty("GameQuestions");
        AllQuestions     = serializedObject.FindProperty("AllQuestions");
        FormerQuestions  = serializedObject.FindProperty("FormerQuestions");
        NewQuestions     = serializedObject.FindProperty("NewQuestions");
        StarredQuestions = serializedObject.FindProperty("StarredQuestions");
        AnswersAvailable = serializedObject.FindProperty("AnswersAvailable");
#endif
    }
示例#57
0
 private void AddGenericType(string s)
 {
     MainController.AdddGenericVisit(s);
 }
示例#58
0
 /// <summary>
 /// Constructeur
 /// </summary>
 public Facade()
 {
     mainControl = new MainController();
     fileControl = new FileController();
 }
示例#59
0
 public void killPlayer()
 {
     Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation);
     GetComponent <SpriteRenderer>().enabled = false;
     StartCoroutine(MainController.EndGame());
 }
示例#60
0
    //Produce
    //Dry Goods
    //Eggs
    //Checkout
    //Start

    // Start is called before the first frame update
    void Start()
    {
        mc     = GameObject.FindObjectOfType <MainController>();
        savers = new Dictionary <string, Item>();
        CreateItems();
    }