コード例 #1
0
ファイル: TicketCell.cs プロジェクト: lunice/bgo
    void Start()
    {
        GameObject resGO = GameObject.Find("RESOURCES");

        resources = resGO.GetComponent <RESOURCES>();
        //objectCaption = GetComponent<ObjectCaption>();
        updateCellCaption();    // инициализациия подписи
        orderLayer = transform.parent.parent.GetComponent <SpriteRenderer>().sortingOrder;
    }
コード例 #2
0
        public ActionResult CreateResource(RESOURCES model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            DbOperations.AddResourceToDB(model);
            return(RedirectToAction("ProjectList"));
        }
コード例 #3
0
 internal void Update(Part part)
 {
     lock (MUTEX)
     {
         this._list(part).Clear();
         foreach (PartResource pr in part.Resources)
         {
             RESOURCES._list(part).Add(Resource_t.From(pr));
         }
     }
 }
コード例 #4
0
ファイル: Errors.cs プロジェクト: lunice/bgo
    public static WarningWindow showWarningWindow()
    {
        var        warningWindowPrefab   = RESOURCES.getPrefab("WarningBuyWindow");
        GameObject warningWindowCanvasGO = GameObject.Instantiate(warningWindowPrefab) as GameObject;

        warningWindowCanvasGO.name = "WarningWindow";
        SoundsSystem.play(Sound.S_ERROR);
        warningWindow = warningWindowCanvasGO.transform.FindChild("WarningWindow").GetComponent <WarningWindow>();
        ScenesController.updateGetActualInputLayer();
        return(warningWindow);
    }
コード例 #5
0
        //public int YesterdaysQuantity;

        public ResourceData(RESOURCES resourceType, int startingQty)
        {
            ResourceType = resourceType;
            Stockpile    = startingQty;
            Demand       = 0;

            Value      = 100;
            BuyAdjust  = 1.001001f;
            SellAdjust = 0.999f;

            PreferredRatio = 5;
            //YesterdaysQuantity = 0;
        }
コード例 #6
0
    //public float MoneyValue;

    public HUDInfo(RESOURCES resourceType, float prod, int pop, int house, float food, float fvalue,
                   float wood, float wvalue, float money)
    {
        ResourceType = resourceType;
        Production   = prod;
        Population   = pop;
        Houses       = house;
        Food         = food;
        FoodValue    = fvalue;
        Wood         = wood;
        WoodValue    = wvalue;
        Money        = money;
    }
コード例 #7
0
    public int prevInputLayer = 0;  // █ предведущий слой/маска тачей запоминается для востановления предведущего слоя после сокрытия фрейма
    // показать фрейм
    public static void show(string requestType = "")
    {
        if (countRequests < 0)
        {
            Errors.showTest("Предупреждение счётчик ожиданий ответов от сервера меньше нуля!");
            countRequests = 0;
        }
        countRequests++; // увеличиваем счётчик запросов от клиента
        if (waitingServerAnsver == null)
        {
            GameObject waitingServerAnsverGO = GameObject.Find("WaitingServerAnsver");
            if (waitingServerAnsverGO == null)
            {
                if (waitingServerAnsverPrefab == null)
                {
                    waitingServerAnsverPrefab = RESOURCES.getPrefab("WaitingServerAnsver");
                }
                waitingServerAnsverGO      = GameObject.Instantiate(waitingServerAnsverPrefab) as GameObject;
                waitingServerAnsverGO.name = "WaitingServerAnsver";
                DontDestroyOnLoad(waitingServerAnsverGO);
            }
            waitingServerAnsver = waitingServerAnsverGO.GetComponent <WaitingServerAnsver>();
            waitingServerAnsver.gameObject.SetActive(false);
        }

        if (callShowTime == 0)
        {
            callShowTime = Time.time;
        }

        /*if (throughTime > 0 && showThroughTime == 0) {
         *  showThroughTime = throughTime;
         *  callShowTime = Time.time;
         *  return;
         * }*/
        waitingServerAnsver.gameObject.SetActive(true);
        // █ изменение слоя

        /*if (MAIN.getMain.actualInputLayer != 0) {
         *  waitingServerAnsver.prevInputLayer = MAIN.getMain.actualInputLayer;
         *  MAIN.getMain.actualInputLayer = 0;
         * }*/
        ScenesController.updateGetActualInputLayer();
        // █ проверка на нарушение последовательсноти запросов
        if (countRequests > 1)
        {
            Errors.showTest("Количество запросов больше 1!(второй запрос:" + requestType + "). сообщите разработчикам. Приложение должно подвиснуть");
        }
    }
コード例 #8
0
    /*public static GameScene currentSene {
     *  get { return GameScene.RAFFLE; }
     * }*/

    void Awake()
    {
        GameObject.DontDestroyOnLoad(gameObject);                   // установка неудаляемости модуля
        if (resourcesPrefab != null)                                // далее инициализация ресурсов и так же установка на неудаляемость
        {
            var resGO = Instantiate(resourcesPrefab).gameObject;
            resGO.name = "RESOURCES";
            resources  = resGO.GetComponent <RESOURCES>();
            GameObject.DontDestroyOnLoad(resGO);
        }
        else
        {
            Debug.Log("Error! [Awake] resourcesPrefab == null");
        }
        scenesController = this;                                    // для быстрого и удобого доступа, к модулю, через статическую переменную
    }
コード例 #9
0
ファイル: Errors.cs プロジェクト: lunice/bgo
    public static ErrorWindow showError(string text, TypeError typeError_, params string[] btnText)
    {
        //Debug.Log("Error! \"" + text + "\", from game scene:" + typeError_.ToString() + Application.stackTraceLogType);
        //Application.RegisterLogCallback(HandleLog);
        //Application.logMessageReceived
        //var resourses = RESOURCES.getResources;
        var        errorWindowPrefab   = RESOURCES.getPrefab("ErrorWindow");
        GameObject errorWindowCanvasGO = GameObject.Instantiate(errorWindowPrefab) as GameObject;

        errorWindowCanvasGO.name = "ErrorWindowCanvas";
        errorWindow = errorWindowCanvasGO.transform.FindChild("ErrorWindow").GetComponent <ErrorWindow>();
        errorWindow.init(text, typeError_, btnText);
        Utils.screenShot("OnError.png"); // только в режиме тестировки
        SoundsSystem.play(Sound.S_ERROR);
        return(errorWindow);
    }
コード例 #10
0
    public float TradeResourceWithLocation(RESOURCES boughtResource, float sellingQuantity, RESOURCES sellingResource, out float refund)
    {
        float offeredValue  = Resources[(int)sellingResource].Value * sellingQuantity;
        float existingValue = (Resources[(int)boughtResource].Stockpile - Resources[(int)boughtResource].Demand - 10) * Resources[(int)boughtResource].Value;

        if (existingValue < 0)
        {
            existingValue = 0;
        }

        if (offeredValue > existingValue)
        {
            //return what is available
            float returningQuantity = existingValue / Resources[(int)boughtResource].Value;
            Resources[(int)boughtResource].Stockpile -= returningQuantity;
            //refund
            float refundingValue = offeredValue - existingValue;
            refund = refundingValue / Resources[(int)sellingResource].Value;
            //update values
            Resources[(int)boughtResource].Value  *= Mathf.Pow(Resources[(int)boughtResource].BuyAdjust, returningQuantity);
            Resources[(int)sellingResource].Value *= Mathf.Pow(Resources[(int)sellingResource].SellAdjust, sellingQuantity - refund);
            if (Resources[(int)sellingResource].Value < 36.77f)
            {
                Resources[(int)sellingResource].Value = 36.77f;
            }
            return(returningQuantity);
        }
        else
        {
            //return equivalent value
            float returningQuantity = offeredValue / Resources[(int)boughtResource].Value;
            Resources[(int)boughtResource].Stockpile -= returningQuantity;
            //update values
            Resources[(int)boughtResource].Value  *= Mathf.Pow(Resources[(int)boughtResource].BuyAdjust, returningQuantity);
            Resources[(int)sellingResource].Value *= Mathf.Pow(Resources[(int)sellingResource].SellAdjust, sellingQuantity);
            if (Resources[(int)sellingResource].Value < 36.77f)
            {
                Resources[(int)sellingResource].Value = 36.77f;
            }
            refund = 0;
            return(returningQuantity);
        }
    }
コード例 #11
0
    // При отрицательном значении, на иконке кнопки, рисуется перечёркнутый круг. Здесь он и создаётся.
    void createNo()
    {
        no = new GameObject("noPic");
        no.transform.parent        = transform;
        no.transform.localPosition = shiftNo;
        var sr       = no.AddComponent <SpriteRenderer>();
        var parentSR = GetComponent <SpriteRenderer>();

        sr.sortingOrder = parentSR.sortingOrder + 1;
        var resGO = GameObject.Find("RESOURCES");

        if (resGO == null)
        {
            Errors.showTest("ресурсы не найдены! (При попытке инициализации CheckBox)");
            return;
        }
        RESOURCES res = resGO.GetComponent <RESOURCES>();

        sr.sprite = res.checkBoxFalse;
    }
コード例 #12
0
 public float GetPrice(RESOURCES resource)
 {
     return(Resources[(int)resource].Value);
 }
コード例 #13
0
        public ActionResult CreateResource()
        {
            var model = new RESOURCES();

            return(View(model));
        }
コード例 #14
0
        public async Task <IHttpActionResult> AddFile()
        {
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            var provider = new MultipartMemoryStreamProvider();

            var lesson_id = Request.Headers.GetValues("lesson_id").First();
            int lessonId  = int.Parse(lesson_id);

            await Request.Content.ReadAsMultipartAsync(provider);

            Entities e       = new Entities();
            var      _lesson = e.LESSONS.FirstOrDefault(m => m.LESSON_ID == lessonId);

            foreach (var file in provider.Contents)
            {
                var filename = file.Headers.ContentDisposition.FileName.Trim('\"');
                var buffer   = await file.ReadAsByteArrayAsync();

                //Do whatever you want with filename and its binary data.


                var       pk   = e.RESOURCES.ToList().Count == 0 ? 0 : e.RESOURCES.Max(s => s.RESOURCE_ID);
                RESOURCES _res = new RESOURCES()
                {
                    RESOURCE_ID       = pk + 1,
                    SCHOOL_ID         = _lesson.SCHOOL_ID,
                    EDUCATION_YEAR_ID = _lesson.EDUCATION_YEAR_ID,
                    NAME            = filename,
                    OBJECTIVE       = _lesson.OBJECTIVE,
                    ATTACHMENT_NAME = filename,
                    ATTACHMENT_EXT  = filename.Split(new char[] { '.' })[filename.Split(new char[] { '.' }).Length - 1]
                };
                e.RESOURCES.Add(_res);
                e.SaveChanges();


                pk = e.LESSONS_SECTIONS.ToList().Count == 0 ? 0 : e.LESSONS_SECTIONS.Max(s => s.LESSON_SECTION_ID);
                LESSONS_SECTIONS _ls = new LESSONS_SECTIONS()
                {
                    LESSON_SECTION_ID = pk + 1,
                    LESSON_ID         = lessonId,
                    RESOURCE_ID       = _res.RESOURCE_ID,
                    ORDR     = _lesson.ORDR,
                    DURATION = _lesson.DURATION,
                    TEACHER  = 1,
                    STUDENTS = 1
                };
                e.LESSONS_SECTIONS.Add(_ls);
                e.SaveChanges();


                pk = e.RESOURCES_LINKS.ToList().Count == 0 ? 0 : e.RESOURCES_LINKS.Max(s => s.RESOURCE_LINK_ID);
                RESOURCES_LINKS _rl = new RESOURCES_LINKS()
                {
                    RESOURCE_LINK_ID = pk + 1,
                    RESOURCE_ID      = _res.RESOURCE_ID,
                    LINK_ID          = _lesson.SESSION_ID,
                    LINK_WITH        = 0
                };
                e.RESOURCES_LINKS.Add(_rl);
                e.SaveChanges();
            }



            return(Ok());
        }