Example #1
0
        private void sendtherapstdata(int uid)
        {
            String pw  = this.password.Text;
            String rpw = this.textBoxrepassword.Text;

            if (pw == rpw)
            {
                //MessageBox.Show("two");
                Tech te = new Tech();

                te.Regno         = textBoxtherapistgrn.Text;
                te.Qualification = textBoxtherapistpq.Text;
                te.Designation   = textBoxtherapistdesignation.Text;
                te.Workingplce   = textBoxtherapistwp.Text;



                usermng uMng = new usermng();
                string  qry  = "insert into cmshdb.technecian(userid,regno,qualifications,designation,workingplace)values('" + uid + "','" + te.Regno + "','" + te.Qualification + "','" + te.Designation + "','" + te.Workingplce + "')";
                uMng.insert(qry);
            }
            else
            {
                MessageBox.Show("there is a error");
            }
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name, TechTypeId")] Tech tech)
        {
            if (id != tech.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tech);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechExists(tech.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tech));
        }
        private Tech AIBaseSelectNextTech(
            StrategicAI ai,
            List <PlayerTechInfo> desiredTech      = null,
            Dictionary <string, int> familyWeights = null)
        {
            Tech tech            = (((Tech)null ?? this.AISelectPartialTech(ai)) ?? AIResearchFramework.AISelectBinaryResponseTech(ai)) ?? this.AISelectDefaultTech(ai, desiredTech, familyWeights);
            Tech researchingTech = AIResearchFramework.AIGetResearchingTech(ai);

            if (tech != null && tech != researchingTech)
            {
                if (this._log != null)
                {
                    if (researchingTech != null)
                    {
                        this._log.Print(string.Format("\n          >>> {0} (replacing {1})\n", (object)tech.Id, (object)researchingTech.Id));
                    }
                    else
                    {
                        this._log.Print(string.Format("\n          >>> {0}\n", (object)tech.Id));
                    }
                }
                return(tech);
            }
            if (this._log != null)
            {
                this._log.ClearRecord();
            }
            return((Tech)null);
        }
Example #4
0
        public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Address,Address2,City,State,ZipCode,Latitude,Longitude,PhoneNumber1,PhoneNumber2,EmailAddress,LastModifiedBy,LastModifiedDateTime,Name")] Tech model)
        {
            if (ModelState.IsValid)
            {
                ApplicationUser user = new ApplicationUser {
                    UserName = model.EmailAddress, Email = model.EmailAddress, FirstName = model.FirstName, LastName = model.LastName, IsConfirmed = true
                };
                ApplicationDbContext.SCreateUser(user, "cfi12345", "Tech");
                model.UserId = user.Id;

                model.LastModifiedById     = User.Identity.GetUserId();
                model.LastModifiedDateTime = DateTime.Now;
                try
                {
                    model.PhoneNumber1 = PhoneNumber10.Reformat(model.PhoneNumber1);
                    model.PhoneNumber2 = PhoneNumber10.Reformat(model.PhoneNumber2);
                    db.Teches.Add(model);
                    db.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                }
                return(RedirectToAction("Edit2", "Tech", new { id = model.UserId }));
            }

            return(View(model));
        }
Example #5
0
        public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Address,Address2,City,State,ZipCode,Latitude,Longitude,PhoneNumber1,PhoneNumber2,EmailAddress,LastModifiedBy,LastModifiedDateTime,Name")] Tech model)
        {
            if (ModelState.IsValid)
            {
                Tech tech2 = db.Teches.Find(model.UserId);
                tech2.FirstName            = model.FirstName;
                tech2.Address              = model.Address;
                tech2.Address2             = model.Address2;
                tech2.City                 = model.City;
                tech2.PhoneNumber1         = PhoneNumber10.Reformat(model.PhoneNumber1);
                tech2.PhoneNumber2         = PhoneNumber10.Reformat(model.PhoneNumber2);
                tech2.LastModifiedById     = User.Identity.GetUserId();
                tech2.LastModifiedDateTime = DateTime.Now;
                tech2.LastName             = model.LastName;
                tech2.Latitude             = model.Latitude;
                tech2.Longitude            = model.Longitude;
                tech2.State                = model.State;
                tech2.ZipCode              = model.ZipCode.Trim();
//				db.Entry(model).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                }

                return(RedirectToAction("Edit2", "Tech", new { id = model.UserId }));
            }
            return(View(model));
        }
    public void CancelResearch(Tech tech, bool clickedEntry = true)
    {
        TechInstance ti = queuedTech.Find((TechInstance qt) => qt.tech == tech);

        if (ti != null)
        {
            if (ti == queuedTech[queuedTech.Count - 1] && clickedEntry)
            {
                SetActiveResearch(null, false);
            }
            int i;
            for (i = ti.tech.unlockedTech.Count - 1; i >= 0; i--)
            {
                if (queuedTech.Find((TechInstance qt) => qt.tech == ti.tech.unlockedTech[i]) != null)
                {
                    CancelResearch(ti.tech.unlockedTech[i], false);
                }
            }
            queuedTech.Remove(ti);
            if (clickedEntry)
            {
                Trigger(-1914338957, queuedTech);
            }
        }
    }
Example #7
0
        public void Can_Remove_Line()
        {
            // Организация - создание нескольких тестовых игр
            Tech tech1 = new Tech {
                TechID = 1, Name = "tech1"
            };
            Tech tech2 = new Tech {
                TechID = 2, Name = "tech2"
            };
            Tech tech3 = new Tech {
                TechID = 3, Name = "tech3"
            };

            // Организация - создание корзины
            Cart cart = new Cart();

            // Организация - добавление нескольких игр в корзину
            cart.AddItem(tech1, 1);
            cart.AddItem(tech2, 4);
            cart.AddItem(tech3, 2);
            cart.AddItem(tech2, 1);

            // Действие
            cart.RemoveLine(tech2);

            // Утверждение
            Assert.AreEqual(cart.Lines.Where(c => c.Tech == tech2).Count(), 0);
            Assert.AreEqual(cart.Lines.Count(), 2);
        }
Example #8
0
        internal void OnDeserialized()
        {
            // Copy the object into the research queue
            var inst    = Research.Instance;
            var dbTechs = Db.Get().Techs;

            if (inst != null && techQueue != null)
            {
                Tech lastTech = null;
                inst.SetActiveResearch(null, true);
                // Add each tech in order
                foreach (var id in techQueue)
                {
                    var tech = dbTechs.Get(id);
                    if (tech != null)
                    {
                        ResearchQueuePatches.ADD_TECH(inst, tech);
                        lastTech = tech;
#if DEBUG
                        PUtil.LogDebug("Added tech to queue: {0}".F(tech.Name));
#endif
                    }
                }
                // Restart the queue
                inst.SetActiveResearch(lastTech, false);
            }
        }
Example #9
0
        /// <summary>
        /// When a research is cancelled, removes from the queue if SHIFT clicked.
        /// </summary>
        /// <param name="targetTech">The technology to queue.</param>
        /// <returns>true to remove the technology normally, or false if this method already
        /// removed the technology.</returns>
        private static bool OnResearchCanceled(Tech targetTech)
        {
            var controller = Global.Instance.GetInputManager()?.GetDefaultController();
            var inst       = ManagementMenu.Instance;
            var screen     = (inst == null) ? null : RESEARCH_SCREEN.Get(inst);
            var research   = Research.Instance;
            // If SHIFT is down (have to use reflection!)
            bool shiftDown = (ACTIVE_MODIFIERS.Get(controller) & Modifier.Shift) != 0, cont =
                true;

            if (research != null && screen != null && !targetTech.IsComplete())
            {
#if DEBUG
                PUtil.LogDebug("Dequeue tech: " + targetTech.Name);
#endif
                // Remove from queue
                screen.CancelResearch();
                research.CancelResearch(targetTech);
                var queue = research.GetResearchQueue();
                // Restack research
                int n = queue.Count;
                research.SetActiveResearch((n > 0) ? queue[n - 1].tech : null, false);
                // The original method would immediately deselect this item, avoid that
                cont = false;
            }
            return(cont);
        }
Example #10
0
        public static (bool suc, string hash) PushTx2Bc(string netStr, Transaction tx, bool useTor = false)
        {
            try
            {
                string req = "";


                if (useTor)
                {
                    req = Tech.webreqTor($"https://api.blockcypher.com/v1/btc/{netStr}/txs/push", "POST", JsonConvert.SerializeObject(new { tx = tx.ToHex() }));
                }
                else
                {
                    req = Tech.webreq($"https://api.blockcypher.com/v1/btc/{netStr}/txs/push", "POST", JsonConvert.SerializeObject(new { tx = tx.ToHex() }));
                }

                var parse = JsonConvert.DeserializeObject <BCtcPushResult>(req);

                return(true, parse.tx.hash);
            }
            catch (Exception e)
            {
                return(false, "");
            }
        }
Example #11
0
        public async Task <ActionResult <Tech> > PostTech(Tech tech)
        {
            _context.Teches.Add(tech);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTech", new { id = tech.Id }, tech));
        }
Example #12
0
        public void RefreshResearchingTech()
        {
            string techID = this.App.GameDatabase.GetTechFileID(this.App.GameDatabase.GetPlayerResearchingTechID(this.App.LocalPlayer.ID));
            string str1   = "Tech\\Icons\\question_mark.bmp";
            string str2   = "Tech\\Icons\\question_mark.bmp";

            if (techID != null)
            {
                Tech tech1 = this.App.AssetDatabase.MasterTechTree.Technologies.First <Tech>((Func <Tech, bool>)(tech => tech.Id == techID));
                if (tech1 != null)
                {
                    str1 = tech1.GetProperIconPath();
                    str2 = "Tech\\Icons\\Research_Icon.bmp";
                }
            }
            else
            {
                techID = this.App.GameDatabase.GetTechFileID(this.App.GameDatabase.GetPlayerFeasibilityStudyTechId(this.App.LocalPlayer.ID));
                if (techID != null)
                {
                    Tech techno = this.App.AssetDatabase.MasterTechTree.Technologies.First <Tech>((Func <Tech, bool>)(tech => tech.Id == techID));
                    if (techno != null)
                    {
                        this.App.AssetDatabase.MasterTechTree.TechFamilies.First <TechFamily>((Func <TechFamily, bool>)(x => x.Id == techno.Family));
                        str1 = techno.GetProperIconPath();
                    }
                }
            }
            this.FamilyTexture = str2;
            this.TechTexture   = str1;
        }
Example #13
0
        /// <summary>
        /// Alters the tech tree for MD-471618 changes.
        /// </summary>
        internal static void TechTreeFix()
        {
            var  techs             = Db.Get().Techs;
            Tech solidTransport    = techs.TryGet("SolidTransport"),
                 solidSpace        = techs.TryGet("SolidSpace"),
                 roboticTools      = techs.TryGet("RoboticTools"),
                 improvedGasPiping = techs.TryGet("ImprovedGasPiping"),
                 portableGases     = techs.TryGet("PortableGasses"),
                 distillation      = techs.TryGet("Distillation"),
                 renaissanceArt    = techs.TryGet("RenaissanceArt"),
                 monuments         = techs.TryGet("Monuments"),
                 highTempForging   = techs.TryGet("HighTempForging");

            solidTransport.AddUnlockedItemIDs(SolidConduitOutboxConfig.ID,
                                              SolidLogicValveConfig.ID, AutoMinerConfig.ID);
            solidSpace.RemoveUnlockedItemIDs(SolidLogicValveConfig.ID,
                                             SolidConduitOutboxConfig.ID);
            improvedGasPiping.AddUnlockedItemIDs(GasBottlerConfig.ID);
            roboticTools.RemoveUnlockedItemIDs(AutoMinerConfig.ID);
            portableGases.RemoveUnlockedItemIDs(GasBottlerConfig.ID);
            distillation.AddUnlockedItemIDs(BottleEmptierGasConfig.ID);
            portableGases.RemoveUnlockedItemIDs(BottleEmptierGasConfig.ID);
            renaissanceArt.AddUnlockedItemIDs(MonumentBottomConfig.ID, MonumentMiddleConfig.ID,
                                              MonumentTopConfig.ID);
            monuments.RemoveUnlockedItemIDs(MonumentBottomConfig.ID, MonumentMiddleConfig.ID,
                                            MonumentTopConfig.ID);
            highTempForging.RemoveUnlockedItemIDs(GantryConfig.ID);
        }
Example #14
0
        public async Task <IActionResult> PutTech(int id, Tech tech)
        {
            if (id != tech.Id)
            {
                return(BadRequest());
            }

            _context.Entry(tech).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TechExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #15
0
        private bool AIHaveReplacementForTech(StrategicAI ai, Tech tech)
        {
            bool flag = false;

            foreach (AIResearchFramework.AITechReplacementRow replacement in this._replacements)
            {
                if (tech == replacement.Old)
                {
                    PlayerTechInfo playerTechInfo = AIResearchFramework.AIGetPlayerTechInfo(ai, replacement.New);
                    if (playerTechInfo != null)
                    {
                        switch (replacement.Contexts)
                        {
                        case AIResearchFramework.AITechReplacementContexts.Available:
                            flag = AIResearchFramework.AIIsTechAvailable(playerTechInfo.State) || AIResearchFramework.AIHaveTech(playerTechInfo.State);
                            break;

                        case AIResearchFramework.AITechReplacementContexts.Researched:
                            flag = AIResearchFramework.AIHaveTech(playerTechInfo.State);
                            break;
                        }
                        if (flag)
                        {
                            break;
                        }
                    }
                }
            }
            return(flag);
        }
Example #16
0
        private Tech AISelectPartialTech(StrategicAI ai)
        {
            Tech tech1 = (Tech)null;

            if (AIResearchFramework.AIGetResearchingTech(ai) == null)
            {
                List <Tech> techList = AIResearchFramework.AISelectAvailableTechs(ai, new AIResearchModes?(), new TechFamilies?());
                if (techList.Count > 0)
                {
                    int num = 0;
                    foreach (Tech tech2 in techList)
                    {
                        int techProgress = AIResearchFramework.AIGetTechProgress(ai, tech2);
                        if (techProgress > num)
                        {
                            num   = techProgress;
                            tech1 = tech2;
                        }
                    }
                }
            }
            if (this._log != null && tech1 != null)
            {
                this._log.Print(string.Format("Resuming {0}", (object)tech1.Id));
            }
            return(tech1);
        }
Example #17
0
        private static Tech AISelectBinaryResponseTech(StrategicAI ai)
        {
            Tech tech = (Tech)null;

            AIResearchFramework.AICanSelectBinaryResponseTech(ai);
            return(tech);
        }
 internal void OnDeserialized()
 {
     if (saveData.techs != null)
     {
         TechInstance.SaveData[] array = saveData.techs;
         for (int i = 0; i < array.Length; i++)
         {
             TechInstance.SaveData save_data = array[i];
             Tech tech = Db.Get().Techs.TryGet(save_data.techId);
             if (tech != null)
             {
                 TechInstance orAdd = GetOrAdd(tech);
                 orAdd.Load(save_data);
             }
         }
     }
     foreach (TechInstance tech2 in techs)
     {
         if (saveData.targetResearchId == tech2.tech.Id)
         {
             SetActiveResearch(tech2.tech, false);
             break;
         }
     }
 }
Example #19
0
 public void AddChild(Tech tech)
 {
     if (!children.Contains(tech))
     {
         children.Add(tech);
     }
 }
Example #20
0
        public static void TestaaItemit()
        {
            Tech laptop = new Tech("Dell", 2017, 2300, "XPS 13", 13.3);

            Console.WriteLine("Kannettavan info:");
            Console.WriteLine(laptop.ToString());
            Console.WriteLine("");

            Tech phone = new Tech("Sony", 2015, 500, "Xperia Z5", 5.5);

            Console.WriteLine("Puhelimen info:");
            Console.WriteLine(phone.ToString());
            Console.WriteLine("");

            Movie movie1 = new Movie("Forrest Gump", 1994, 2, 144);

            Console.WriteLine("Elokuva 1:n info:");
            Console.WriteLine(movie1.ToString());
            Console.WriteLine("");

            Movie movie2 = new Movie("The Matrix", 1999, 3, 136);

            Console.WriteLine("Elokuva 2:n info:");
            Console.WriteLine(movie2.ToString());
            Console.WriteLine("");
        }
            public static void Postfix(ref Database.Techs __instance)
            {
                // Add to `Basic Farming` technology
                Tech techBasicFarming = __instance.TryGetTechForTechItem("RationBox");

                techBasicFarming.unlockedItemIDs.Add(DirtTileConfig.ID);
            }
Example #22
0
    public override void UpdateHoverElements(List <KSelectable> selected)
    {
        HoverTextScreen instance        = HoverTextScreen.Instance;
        HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        switch (currentReqState)
        {
        case PlanScreen.RequirementsState.Materials:
        case PlanScreen.RequirementsState.Complete:
            hoverTextDrawer.DrawText(UI.TOOLTIPS.NOMATERIAL.text.ToUpper(), HoverTextStyleSettings[0]);
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawText(UI.TOOLTIPS.SELECTAMATERIAL, HoverTextStyleSettings[1]);
            break;

        case PlanScreen.RequirementsState.Tech:
        {
            TechItem techItem   = Db.Get().TechItems.Get(currentDef.PrefabID);
            Tech     parentTech = techItem.parentTech;
            hoverTextDrawer.DrawText(string.Format(UI.PRODUCTINFO_RESEARCHREQUIRED, parentTech.Name).ToUpper(), HoverTextStyleSettings[0]);
            break;
        }
        }
        hoverTextDrawer.NewLine(26);
        hoverTextDrawer.DrawIcon(instance.GetSprite("icon_mouse_right"), 18);
        hoverTextDrawer.DrawText(backStr, Styles_Instruction.Standard);
        hoverTextDrawer.EndShadowBar();
        hoverTextDrawer.EndDrawing();
    }
        public async Task <ActionResult <Tech> > PostTeches(Tech tech)
        {
            _context.Techs.Add(tech);
            await _context.SaveChangesAsync();

            return(Created("", tech));
        }
Example #24
0
        /// <summary>
        /// When a research is cancelled, removes from the queue if SHIFT clicked.
        /// </summary>
        /// <param name="targetTech">The technology to queue.</param>
        /// <returns>true to remove the technology normally, or false if this method already
        /// removed the technology.</returns>
        private static bool OnResearchCanceled(Tech targetTech)
        {
            var controller = Global.Instance.GetInputManager()?.GetDefaultController();
            var screen     = ManagementMenu.Instance?.researchScreen as ResearchScreen;
            var research   = Research.Instance;
            // If SHIFT is down (have to use reflection!)
            bool shiftDown = activeModifiers != null && (activeModifiers.GetValue(controller)
                                                         is Modifier mods) && mods == Modifier.Shift, cont = true;

            if (research != null && screen != null && !targetTech.IsComplete())
            {
#if DEBUG
                PUtil.LogDebug("Dequeue tech: " + targetTech.Name);
#endif
                // Remove from queue
                screen.CancelResearch();
                research.CancelResearch(targetTech);
                var queue = research.GetResearchQueue();
                // Restack research
                int n = queue.Count;
                research.SetActiveResearch((n > 0) ? queue[n - 1].tech : null, false);
                // The original method would immediately deselect this item, avoid that
                cont = false;
            }
            return(cont);
        }
Example #25
0
 public void AddTech(Tech t)
 {
     AllTechnologies.Add(t);
     TechByID.Add(t.ID, t);
     Debug.Log("Importing tech: " + t.Name);
     Debug.Log(string.Format("Name: {0}, Requirements: {1}", t.Name, t.Requirements.Count));
 }
Example #26
0
        private static void Postfix()
        {
            if (typeof(Database.Techs).GetField("TECH_GROUPING") == null)
            {
                Tech tech = Db.Get().Techs.TryGet(TechID);
                if (tech == null)
                {
                    return;
                }
                ICollection <string> list = (ICollection <string>)tech.GetType().GetField("unlockedItemIDs")?.GetValue(tech);
                if (list == null)
                {
                    return;
                }

                list.Add(Building.Config.LiquidBottlerConfig.ID);
                list.Add(Building.Config.LiquidBottleEmptierConfig.ID);
            }
            else
            {
                System.Reflection.FieldInfo   info = typeof(Database.Techs).GetField("TECH_GROUPING");
                Dictionary <string, string[]> dict = (Dictionary <string, string[]>)info.GetValue(null);
                dict[TechID].Append(Building.Config.LiquidBottlerConfig.ID);
                dict[TechID].Append(Building.Config.LiquidBottleEmptierConfig.ID);
                typeof(Database.Techs).GetField("TECH_GROUPING").SetValue(null, dict);
            }
        }
        internal void OnDeserialized()
        {
            // Copy the object into the research queue
            var inst    = Research.Instance;
            var dbTechs = Db.Get().Techs;

            if (inst != null && techQueue != null)
            {
                var trInst = Traverse.Create(inst).Method("AddTechToQueue", TECH_ARGS);
                if (trInst.MethodExists())
                {
                    Tech lastTech = null;
                    inst.SetActiveResearch(null, true);
                    // Add each tech in order
                    foreach (var id in techQueue)
                    {
                        var tech = dbTechs.Get(id);
                        if (tech != null)
                        {
                            trInst.GetValue(tech);
                            lastTech = tech;
#if DEBUG
                            PUtil.LogDebug("Added tech to queue: {0}".F(tech.Name));
#endif
                        }
                    }
                    // Restart the queue
                    inst.SetActiveResearch(lastTech, false);
                }
                else
                {
                    PUtil.LogWarning("Could not find AddTechToQueue method!");
                }
            }
        }
Example #28
0
 private IEnumerable <AIResearchFramework.TechBeat> AIGetTechBeats(
     IEnumerable <Tech> techs,
     List <AIResearchModes> rhythm,
     List <PlayerTechInfo> desiredTech = null)
 {
     foreach (Tech tech1 in techs)
     {
         Tech tech = tech1;
         for (int beat = 0; beat < rhythm.Count; ++beat)
         {
             if (AIResearchFramework.AIContainsTech(new AIResearchModes?(rhythm[beat]), new TechFamilies?(), tech))
             {
                 if (desiredTech != null)
                 {
                     desiredTech.Any <PlayerTechInfo>((Func <PlayerTechInfo, bool>)(x => x.TechFileID == tech.Id));
                 }
                 yield return(new AIResearchFramework.TechBeat()
                 {
                     Tech = tech,
                     Beat = beat
                 });
             }
         }
     }
 }
Example #29
0
        private int CalculateLevel(Tech tech, Dictionary <int, int> tierStartingLengths)
        {
            // number of techs in the same tier that are pre-requistes, so must be on lower levels, this may be 0.
            var levelInTier = NumberOfPrereqsInSameTier(tech);

            return(tierStartingLengths[tech.TierValue] + levelInTier);
        }
 public bool IsBeingResearched(Tech tech)
 {
     if (activeResearch == null || tech == null)
     {
         return(false);
     }
     return(activeResearch.tech == tech);
 }
 public void AddTech(Tech tech)
 {
     int i = 0;
     string name = tech.Name + System.Convert.ToInt32(i);
     while (techs.ContainsKey(name)) {
         i++;
         name = tech.Name + System.Convert.ToInt32 (i);
     }
 }
Example #32
0
 internal System.Data.DataTable GetActiveCompany(Tech.LumexDBPlayer db)
 {
     try
     {
         DataTable dt = db.ExecuteDataTable("GET_ACTIVE_COMPANY_LIST", false);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #33
0
	// Allows Custom techs to be implemented.
	public void AddCustomTech(string previousTechName)
	{
		tree.techTree.TryGetValue(previousTechName, out previous);

		if (previous == null)
			return;
	
		// Resize the array to allow new tech.
		Tech[] temp = new Tech[next.Length - 1];
		next.CopyTo(temp, 0);
		next = new Tech[temp.Length + 1];
		temp.CopyTo(next, 0);
		next[next.Length-1] = this;
	}
Example #34
0
    public void chooseTech()
    {
        print("chooseTech");
        List<Tech> unlockedTechs = new List<Tech>();

        foreach (Tech t in Game.techs)
        {
            if(t.known && !t.got && t.level <= Game.govLevel)
            {
                unlockedTechs.Add(t);
            }
        }

        demandedTech = unlockedTechs[Random.Range(0,unlockedTechs.Count)];

        int i = Random.Range(0, orderData["Orders"].Count);
        string orderText = orderData["Orders"][i].ToString();
        Timeline.instance.orderText = orderText.Replace(@"[/Random/]", demandedTech.name.ToUpper());
        Timeline.instance.orderText = Timeline.instance.orderText.Replace(@"[/Party/]", Name.partyName);
        Timeline.instance.haveInstructions = true;
    }
Example #35
0
 public void compare(Tech boughtTech)
 {
     if(boughtTech == demandedTech && demandedTech != null)
     {
         int i = Random.Range(0, orderData["Reward"].Count);
         Timeline.instance.resultText = orderData["Reward"][i].ToString();
         Timeline.instance.haveResult = true;
         if(rewardCount < 0)
         {
             rewardCount = 0;
         }
         rewardCount++;
         complianceCount++;
         if(rewardCount > 3)
         {
             rewardCount = 3;
         }
         StartCoroutine(rewardPuppet(rewardCount));
         chooseTech();
     }
     else
     {
         int i = Random.Range(0, orderData["Failure"].Count);
         Timeline.instance.resultText = orderData["Failure"][i].ToString();
         Timeline.instance.haveResult = true;
         if(rewardCount > 0)
         {
             rewardCount = 0;
         }
         rewardCount--;
         complianceCount--;
         if(rewardCount < -3)
         {
             rewardCount = -3;
         }
         StartCoroutine(punishPuppet(-rewardCount));
     }
 }
Example #36
0
 public Person(Stats stats, Tech tech)
 {
     this.stats = stats;
     this.tech = tech;
 }
Example #37
0
 public void Close()
 {
     foreach (Tech t in Game.techs)
     {
         t.Highlight.enabled = false;
     }
     if (Tutorial.InProgress == false)
     {
         SnapPanel.instance.MovingToMap = true;
     }
     myTech = null;
     confirm.SetActive(false);
     Tips.instance.NationalTips();
 }
Example #38
0
 public void Start()
 {
     myTech = null;
     policyConfirm.SetActive(false);
     controlConfirm.SetActive(false);
     policySellButton.SetActive(false);
     controlSellButton.SetActive(false);
     policyActivated.SetActive(false);
     controlActivated.SetActive(false);
     policyDetailsTitle.text = "";
     policyDetailsText.text = "";
     policyDetailsInfluence.text = "";
     controlDetailsTitle.text = "";
     controlDetailsText.text = "";
     controlDetailsInfluence.text = "";
     ArmyAnim.SetBool("IN", false);
 }
        internal System.Data.DataTable SaveOpenningBalance(BLL.OpenningBalanceBLL openningBalanceBLL, Tech.LumexDBPlayer db)
        {
            try
            {
                DataTable dt=new DataTable();
                if (openningBalanceBLL.PayToFromType == "ven")
                {
                    db.AddParameters("@WarehouseId", openningBalanceBLL.OfficeBranchId.Trim());
                    db.AddParameters("@PurchaseRequisitionId", "");
                    db.AddParameters("@PurchaseOrderId", "");
                    db.AddParameters("@VendorId", openningBalanceBLL.PayToFromCompany);
                    db.AddParameters("@VendorOrderDate", openningBalanceBLL.TransectionDate);
                    db.AddParameters("@VendorOrderNumber", "");
                    db.AddParameters("@VendorInvoiceNumber","");
                    db.AddParameters("@ReceivedDate", "");
                    db.AddParameters("@TotalAmount", openningBalanceBLL.Amount);
                    //db.AddParameters("@VAT", purchaseRecord.VAT.Trim());
                    db.AddParameters("@DiscountAmount", "0.00");

                  

                    if (openningBalanceBLL.Type == "Rec")
                    {
                        db.AddParameters("@TotalPayable", "0.00");
                        db.AddParameters("@PaidAmount", openningBalanceBLL.Amount);
                        db.AddParameters("@Narration", "Purchase Entry for Opening Balance Receivable Amount. "+openningBalanceBLL.Naretion);
                    }
                    else
                    {

                        db.AddParameters("@TotalPayable", openningBalanceBLL.Amount);
                        db.AddParameters("@PaidAmount", "0.00");
                        db.AddParameters("@Narration", "Purchase Entry for Opening Balance Payable Amount. "+ openningBalanceBLL.Naretion);
             
                    }


                    db.AddParameters("@TransportCost", "0.00");
                  
                    db.AddParameters("@LCNumber", "");
                    db.AddParameters("@TransportType", "");
                    db.AddParameters("@ShippingAddress", "");
                    db.AddParameters("@BillingAddress","");
                    db.AddParameters("@PaymentMode", "");
                    db.AddParameters("@AccountId", "A45");
                    db.AddParameters("@Bank", "");
                    db.AddParameters("@BankBranch", "");
                    db.AddParameters("@ChequeNumber", "");
                    db.AddParameters("@ChequeDate","");
                    db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                    db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());

                    dt = db.ExecuteDataTable("INSERT_WAREHOUSE_PURCHASE_RECORD_FOR_OPENING", true);

                }
                else if (openningBalanceBLL.PayToFromType == "cus")
                {

                    db.AddParameters("@CustomerId", openningBalanceBLL.PayToFromCompany.Trim());
                    db.AddParameters("@CustomerName", openningBalanceBLL.PayToFromCompanyName);
                    db.AddParameters("@CustomerContactNumber", "");
                    db.AddParameters("@CustomerAddress", "");
                    db.AddParameters("@SalesCenterId", openningBalanceBLL.OfficeBranchId);
                    db.AddParameters("@TotalAmount", openningBalanceBLL.Amount);
                    db.AddParameters("@DiscountAmount", "0.00");
                    db.AddParameters("@VAT", "0.00");
                    if (openningBalanceBLL.Type == "Rec")
                    {
                        db.AddParameters("@TotalReceivable", openningBalanceBLL.Amount);
                        db.AddParameters("@ReceivedAmount", "0.00");
                        db.AddParameters("@Narration", "Sales Entry for Opening Balance Receivable Amount. "+openningBalanceBLL.Naretion);
                    }
                    else
                    {

                        db.AddParameters("@TotalReceivable", "0.00");
                        db.AddParameters("@ReceivedAmount", openningBalanceBLL.Amount);
                        db.AddParameters("@Narration", "Sales Entry for Opening Balance Payable Amount. "+openningBalanceBLL.Naretion);
                    }


                    db.AddParameters("@ChangeAmount", "0.00");
                    db.AddParameters("@TotalVATAmount", "0.00");
                    db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                    db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());
                    db.AddParameters("@SalesOrderId", "");

                    //New Add

                    db.AddParameters("@PaymentMode", "");
                    db.AddParameters("@AccountId", "A45");
                    db.AddParameters("@Bank", "");
                    db.AddParameters("@BankBranch", "");
                    db.AddParameters("@ChequeNumber", "");
                    db.AddParameters("@ChequeDate", "");
                    db.AddParameters("@OthersDes", "");
                    db.AddParameters("@OthersAmount", "0.00");

                    //
                    dt = db.ExecuteDataTable("[INSERT_RETAIL_SALES_RECORD_FOR_OPENING]", true);

                }
                //db.AddParameters("@AccountId",openningBalanceBLL.AccountId);
                //db.AddParameters("@Amount",openningBalanceBLL.Amount);
                //db.AddParameters("@OfficeBranchId", openningBalanceBLL.OfficeBranchId);
                //db.AddParameters("@DebitCredit",openningBalanceBLL.DebitOrCredit);
                //db.AddParameters("@PayToFromCompany",openningBalanceBLL.PayToFromCompany);
                //db.AddParameters("@Narration",openningBalanceBLL.Naretion);
                //db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                //db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());
                //db.AddParameters("@TransectionDate",openningBalanceBLL.TransectionDate);
                //db.AddParameters("@IsRecPay",openningBalanceBLL.Type);
                //DataTable dt = db.ExecuteDataTable("INSERT_OPANING_BALANCE_LEDGER_WISE", true);
                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                openningBalanceBLL = null;
            }
        }
    private Tech[] readFullTechsBlock(string fileName, StreamReader reader)
    {
        Dictionary<string, Tech> techs = new Dictionary<string, Tech>();
        Dictionary<Tech, string[]> prereqs = new Dictionary<Tech, string[]>();

        string line = reader.ReadLine().Trim ();

        do {
            if (line == "<{>") {
                // Start of an outermost block
                line = reader.ReadLine().Trim ();
                Tech tech = new Tech ();
                do {
                    string[] lineParts;
                    //Split category name from data
                    lineParts = line.Split(":".ToCharArray(), 2);

                    //Remove any extra whitespace from parts & set descriptive variables
                    string dataType = gameManager.LanguageMgr.StringToDataType(lineParts[0].Trim ());
                    string dataText = lineParts[1].Trim ();

                    if (dataType == "Name") {
                        tech.Name = readTextLine(dataType, dataText, fileName);
                    } else if (dataType == "Color") {
                        tech.TechType = gameManager.LanguageMgr.StringToTType(readTextLine(dataType, dataText, fileName));
                    } else if (dataType == "Expansion") {
                        tech.Expansion = gameManager.LanguageMgr.StringToExpansion(readTextLine(dataType, dataText, fileName));
                    } else if (dataType == "Requires") {
                        // The prereq techs may not actually exist yet, so just save the name for now
                        prereqs[tech] = readTextBlock (dataType, dataText, fileName, reader);
                    } else if (dataType == "Text") {
                        tech.Text = readTextLine(dataType, dataText, fileName);
                    } else if (dataType == "Cost") {
                        tech.Cost = readIntLine(dataType, dataText, fileName);
                        // Only racial techs have a cost.
                        tech.TechType = TType.Racial;
                    } else if (dataType == "ID") {
                        tech.Id = readTextLine (dataType, dataText, fileName);
                    }
                    line = reader.ReadLine().Trim ();
                } while (line != "<}>");
                // End of outermost block

                if (!techs.ContainsKey(tech.Name)) {
                    techs[tech.Name] = tech;
                } else {
                    techs[tech.Name + "/" + tech.Expansion] = tech;
                }

                if (!reader.EndOfStream) {
                    line = reader.ReadLine ().Trim ();
                }
            }
        } while (line == "<{>");

        // All techs have been created, so fill in prereqs (if any)
        foreach (Tech tech in techs.Values) {
            ArrayList prereqObjects = new ArrayList();

            if (prereqs.Keys.Count > 0) {
                foreach (string techName in prereqs[tech]) {
                    if (gameManager.LanguageMgr.HasTPrereqMode(techName)) {
                        tech.PrereqMode = gameManager.LanguageMgr.StringToTPrereqMode(techName);
                    } else if (techs.ContainsKey(techName)) {
                        prereqObjects.Add(techs[techName]);
                    }
                }
                tech.Prereqs = (Tech[])prereqObjects.ToArray(typeof(Tech));
            }
            if (tech.Id == default(string)) {
                tech.Id = tech.Name;
            }
        }

        Tech[] techsArray = new Tech[techs.Values.Count];
        techs.Values.CopyTo(techsArray, 0);

        return techsArray;
    }
Example #41
0
 void RandomTech()
 {
     tempTech = Game.techs[Random.Range(0, Game.techs.Length)];
 }